FFORGE

Tutorial · 13 min read · Updated November 2026

How to make a Roblox survival game with AI (99 Nights style)

99 Nights in the Forest made co-op survival one of the biggest genres on Roblox: chop wood by day, keep the campfire burning, craft better gear, and hold out with friends while things come out of the dark. This guide shows how to build an original co-op survival game inside your own Roblox Studio place, with the hard parts (a server-owned clock, safe saving, creatures that do not melt the server) done properly. The prompts are written for Forge and work as a checklist with any AI agent.

Make your own game, not a copy. Day and night, campfires, crafting and base defence are a genre many games share. The story, characters, creatures, map, art, names and UI of 99 Nights in the Forest are not yours to use. Everything below is setting-agnostic: pick your own world (a frozen tundra, a sunken city, an alien jungle, an abandoned theme park) and make your own creatures and art.

The loop, piece by piece

Why it is harder to build right than it looks

Each piece is simple. Most survival games feel broken because of what sits under them.

The clock and the run belong to the server

One server script owns the run: the phase, time left, night number, fire fuel, and whether the run is won or wiped. It replicates these as attributes. Clients only show them, by tweening Lighting.ClockTime, fog and ambient colour. Creature spawns, fire drain and needs all read the server clock. If any of it lives on the client, players see different nights and exploiters can freeze time.

Gathering, crafting and building are server decisions

The client may only ask: "hit tree 41", "craft recipe torch", "place wall at this grid cell". The server checks distance, the tool's cooldown, that the player owns the materials, that the cell is free and inside the build radius, then changes the inventory and spawns the piece. Resource node health lives on the server. Never let a remote carry an amount, an item count or a damage number.

Saving must be session-locked

Runs are short and live in their own server, so most of a run does not need saving. Meta progress does. Use DataStore UpdateAsync with a session lock so a player who leaves one run and joins another fast can never have two servers writing their data at once. Grant end-of-run rewards in one write, save on leave and in BindToClose, and keep a version number in the data so later updates can migrate it.

ProcessReceipt must be idempotent

Products like a revive or a bundle of starter kits go through one ProcessReceipt callback that records each PurchaseId before granting, so a retried receipt never grants twice. If the buyer is no longer in a run, store the grant and apply it next time. The game pass guide has the full pattern.

Performance after twenty nights

By night twenty a server can hold hundreds of dropped logs, a big base and a wave of creatures. What keeps it smooth:

Runs need their own servers

A good survival run is a group of friends in a private world. Use a small lobby place where a party gathers, then TeleportService with a reserved server for each run. Pass the party and any settings in teleport data, and check them on the server when players arrive. Teleports only work in a published place, so build and test the run itself first.

A Config module: one place for every number

Put every timing, cost and scaling number in one ModuleScript, ReplicatedStorage/Config/Survival. Scripts read from it and never hard-code a number. Balancing then means editing one file, and asking the AI to "make night 10 harder" changes one line instead of five scripts.

-- ReplicatedStorage/Config/Survival (shape only)
return {
  nightsToWin = 30,
  dayLength = 360, nightLength = 240, -- seconds
  fire = { maxFuel = 300, burnPerSecond = 1, safeRadius = 30 },
  needs = { hungerDrain = 0.25, warmthDrain = 0.5 }, -- per second
  creatures = {
    baseCount = 4, countPerNight = 1.5, maxAlive = 40,
    healthScale = 1.08, -- x per night
  },
  benchTiers = {
    { wood = 0 }, { wood = 40, stone = 20 },
    { wood = 120, stone = 80, scrap = 20 },
  },
}

Creatures and models without copying

Your creatures are what make the game yours, so design them for your world. Studio's MCP server exposes generate_mesh, which an agent can call to create meshes inside your place. Write one locked style prompt (for example "stylised low-poly, dark silhouettes, glowing eyes, no text, 2,000 to 5,000 triangles") and reuse it for every creature and prop so they match. You can also attach up to four reference images (sketches or mood boards you made) to a Forge message and it builds to match. When a generation does not work, fall back to free Creator Store models checked for scripts and a clear licence. Never import another game's creatures.

The starter prompt for Forge

Paste this as your first message. It sets the rules for the whole build and does Phase 1.

We are building an ORIGINAL co-op survival game for Roblox. Do not
use any names, story, creatures, models, art or UI from existing
games. Setting: a frozen tundra ("Last Light"). Every number lives in
ReplicatedStorage/Config/Survival.

Rules for the whole build: the server owns the run, the clock, fire
fuel, needs, inventories, resource health, crafting and building.
Remotes send intent only (hit node X, craft recipe Y, place piece Z
at cell C), never amounts or damage. Every remote validates types,
distance, ownership and rate. Clients only render: lighting, effects,
sounds, UI. Meta progress saves with DataStore UpdateAsync,
session-locked, with a data version number.

We work in 6 phases and I will say "next" between them:
1 run + day/night + campfire, 2 gathering + inventory, 3 crafting +
building, 4 night creatures, 5 lobby + map + UI, 6 saving +
monetization + security.

Phase 1 now: the Config module, a server run state machine (Day,
Night, Won, Wiped), a day/night clock (6 min day, 4 min night, shorten
both to 30 s with a debug flag), clients tweening Lighting from the
server clock, a campfire with fuel that burns 1 per second and a 30
stud safe radius, hunger and warmth that drain and refill near the
fire, and a wipe when every player is down. Playtest with 2 clients
in debug mode through 3 nights. Screenshot day and night.

Follow-up messages, one per phase

Phase 2: gathering and inventory.

Next. Add trees (wood), rocks (stone) and wrecks (scrap) with health
on the server. An axe and a pickaxe; hits are checked for distance
(10 studs) and a 0.4 s cooldown. Broken nodes drop items and respawn
after 3 minutes (hide and reuse, do not destroy). Dropped items: cap
150 per server, merge stacks within 4 studs, despawn after 3 min.
Server-owned backpack with 20 slots. Feeding logs to the fire adds
30 fuel each. Test with 2 clients and screenshot the backpack.

Phase 3: crafting and building.

Next. A crafting bench with 3 tiers (costs in Config). Recipes: stone
axe, stone pickaxe, spear, torch, wooden wall, gate, spike trap,
standing lantern. Building: pieces snap to a 4 stud grid within 40
studs of the fire, the server checks materials, cell free and in
range, then places an anchored piece with health. A ghost preview on
the client. Test placing, blocked cells and missing materials.
Screenshot a small walled base.

Phase 4: night creatures.

Next. Two original creature types for the tundra: a fast pack hunter
and a slow brute that targets walls. Spawn outside the fire light at
nightfall; count = baseCount + countPerNight x night, capped at
maxAlive with the rest queued. Health scales by healthScale per
night. Pathfinding recomputed every 1 s, not every frame. Creatures
take damage inside the lit radius. Every 5th night adds one elite.
Use generate_mesh with this locked style: "[your style prompt]".
Run nights 1, 10 and 20 in debug mode and print server frame time
and creature count for each. Screenshot night 10.

Phase 5: lobby, map and UI.

Next. Build the forest map: a clearing for the fire, resource
clusters that get richer further out, three wrecks with chests, and
fog that thickens at night. StreamingEnabled on. Make a separate
lobby with a party pad that teleports up to 6 players to a reserved
server and passes the party in teleport data (validated on arrival).
Scale-based HUD: night number, time left, fire fuel bar, hunger and
warmth. A crafting menu and a run summary screen. Check the phone
preset in the device emulator. Screenshot the HUD on a phone.

Phase 6: saving, monetization and security.

Next. Meta currency earned per night survived, granted once at run
end, saved session-locked. Unlocks: 3 starting kits and 2 classes.
Placeholder-id game passes: Bigger Backpack (+10 slots), VIP (chat
tag, cosmetic lantern), Extra Class. Developer products: Revive
(once per night per player) and a cosmetic bundle. One
ProcessReceipt, idempotent by PurchaseId, storing grants for players
not in a run. Then review every remote for type, range, ownership and
rate checks, and print a table of fire fuel and creature count per
night so I can balance. Summarise the changes.

Create the real passes and products on the Roblox website and paste their ids into the constants. The agent cannot do that part. Publish the place before testing the lobby teleport.

Monetization ideas that fit the loop

ProductTypeWhy players buy it
Bigger backpackGame passFewer trips back to base while gathering
Extra classGame passA new way to play each run, such as a builder or a scout
VIPGame passStatus and a cosmetic, with no power in a co-op run
ReviveDeveloper productGets back into a run the party cares about, limited to once per night
CosmeticsDeveloper productFire colours, lanterns and outfits friends can see
Private serverRoblox settingGroups who play together every week

Keep the run winnable without paying. Co-op games spread through friend groups, and one player who feels the game is pay-to-win can turn the whole group away.

Honest limits

Questions

Can I copy 99 Nights in the Forest?

No. Day and night cycles, campfires, crafting and base defence are a genre many games share, but the story, characters, creatures, map, art, names and UI of 99 Nights in the Forest belong to its developer. Build the loop yourself with your own setting, creatures and art.

How do I make a day and night cycle in Roblox Studio?

Keep one clock on the server that tracks the phase and time left, and replicate it with attributes. Each client tweens Lighting.ClockTime, ambient colour and fog from that value. Gameplay reads the server clock, never the client lighting.

How do I stop exploiters from duping items?

Keep the inventory on the server. The client asks to hit a node or craft a recipe; the server checks distance, remaining resources, ingredients, backpack space and rate, then changes the inventory itself. Never accept item names or counts from the client.

Why does my survival game lag after a few nights?

Usually too many loose parts and creatures. Cap and despawn dropped items, merge stacks, cap live creatures, use simple collision boxes, anchor built pieces, and turn on StreamingEnabled.

Does TeleportService work in a Studio playtest?

No. Teleports to reserved servers only work in a published place. Build and test the run in one place first, then publish and test the lobby with real accounts.

How long does it take to build with AI?

The six phases take a weekend or two of prompting and playtesting. Tuning how hard each night feels takes longer, and you learn it from groups of real players.

Related guides

Build your own survival game in Forge. Pair your Studio, paste the starter prompt and get a playtest screenshot back. Trial credits, no card. Try Forge free →