Tutorial · Gameplay

How to make a rising lava game in Roblox Studio

In a rising lava game, players are dropped onto a map and the floor starts to fill with lava. They climb, the lava follows, and whoever is still above it when the timer ends wins the round. It is a round system with one hazard. This guide builds the whole loop in one server Script: waiting in the lobby, teleporting to the map, lava that climbs and kills, a win for the survivors, and a reset so the next round starts clean, plus a label that tells players what is happening.

Updated 14 November 20268 min readIntermediateLuauWritten by

In short

Use one Script in ServerScriptService running a while true do loop. Each round: teleport players to the map with character:PivotTo, put the lava part back at its start CFrame, and play a TweenService tween that moves it up. Every frame, kill any player whose root part is inside the lava. When the timer ends or no one is left, cancel the tween, give survivors a Win and send them back to the lobby.

  • Save the lava's starting CFrame once when the script starts, and set it back at the start of every round. That is the whole reset.
  • A moving anchored part may not fire Touched on a player who stands still, so check positions every frame instead.
  • The server runs the round. The client only shows the status text it reads from an attribute.

Get the script

Rising lava round script

One Script in ServerScriptService: rounds where lava climbs the map, kills anyone it reaches, and gives the survivors a Win, then resets.

Script in ServerScriptService named LavaRounds
-- Script in ServerScriptService named LavaRounds.
-- Rounds where lava climbs the map. Survivors at the end win.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

local RISE_STUDS = 80 -- how far the lava climbs in one round
local ROUND_SECONDS = 90 -- how long the climb takes
local MIN_PLAYERS = 1 -- players needed to start (use 2 or more in a live game)
local INTERMISSION_SECONDS = 15
local RESULTS_SECONDS = 5

local map = workspace:WaitForChild("LavaMap")
local lava = map:WaitForChild("Lava") :: BasePart
local mapSpawn = map:WaitForChild("MapSpawn") :: BasePart
local lobbySpawn = workspace:FindFirstChildWhichIsA("SpawnLocation", true)

lava.Anchored = true
local lavaStart = lava.CFrame -- saved once: every round resets the lava to this

local inRound: { [Player]: boolean } = {}
local roundActive = false

local function setStatus(text: string)
	-- The RoundStatus LocalScript shows this on every screen
	ReplicatedStorage:SetAttribute("RoundStatus", text)
end

local function getLiveHumanoid(player: Player): (Humanoid?, BasePart?)
	local character = player.Character
	local humanoid = character and character:FindFirstChildOfClass("Humanoid")
	local root = humanoid and humanoid.RootPart
	if humanoid and root and humanoid.Health > 0 then
		return humanoid, root
	end
	return nil, nil
end

local function countAlive(): number
	local count = 0
	for _ in inRound do
		count += 1
	end
	return count
end

local function addWin(player: Player)
	local leaderstats = player:FindFirstChild("leaderstats")
	local wins = leaderstats and leaderstats:FindFirstChild("Wins")
	if wins and wins:IsA("IntValue") then
		wins.Value += 1
	end
end

-- Every frame during a round: anyone inside the lava dies
RunService.Heartbeat:Connect(function()
	if not roundActive then
		return
	end
	local half = lava.Size / 2
	for player in inRound do
		local humanoid, root = getLiveHumanoid(player)
		if humanoid and root then
			local offset = lava.CFrame:PointToObjectSpace(root.Position)
			if math.abs(offset.X) <= half.X and math.abs(offset.Z) <= half.Z and offset.Y <= half.Y then
				humanoid.Health = 0 -- kills through a ForceField too
			end
		end
	end
end)

-- Wins on the player list
local function onPlayerAdded(player: Player)
	if player:FindFirstChild("leaderstats") then
		return
	end
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	local wins = Instance.new("IntValue")
	wins.Name = "Wins"
	wins.Parent = leaderstats
	leaderstats.Parent = player
end
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
	onPlayerAdded(player) -- players who joined while the script waited for the map
end

Players.PlayerRemoving:Connect(function(player: Player)
	inRound[player] = nil
end)

local function runRound()
	-- Reset the lava and send everyone to the map
	lava.CFrame = lavaStart
	table.clear(inRound)
	for index, player in Players:GetPlayers() do
		local humanoid = getLiveHumanoid(player)
		local character = player.Character
		if humanoid and character then
			-- Spread players out a little so they do not land inside each other
			local spread = Vector3.new((index % 4) * 3 - 4.5, 3, math.floor(index / 4) * 3)
			character:PivotTo(mapSpawn.CFrame + spread)
			inRound[player] = true
			humanoid.Died:Once(function()
				inRound[player] = nil
			end)
		end
	end

	local rise = TweenService:Create(lava, TweenInfo.new(ROUND_SECONDS, Enum.EasingStyle.Linear), {
		CFrame = lavaStart + Vector3.new(0, RISE_STUDS, 0),
	})
	rise:Play()
	roundActive = true

	local started = os.clock()
	while os.clock() - started < ROUND_SECONDS and countAlive() > 0 do
		local left = math.ceil(ROUND_SECONDS - (os.clock() - started))
		setStatus(string.format("The lava is rising! %d s left, %d alive", left, countAlive()))
		task.wait(0.25)
	end
	roundActive = false
	rise:Cancel()

	-- Results: survivors win and go back to the lobby
	local winners = {}
	for player in inRound do
		if getLiveHumanoid(player) then
			addWin(player)
			table.insert(winners, player.Name)
			local character = player.Character
			if character and lobbySpawn then
				character:PivotTo(lobbySpawn.CFrame + Vector3.new(0, 4, 0))
			end
		end
	end
	table.clear(inRound)
	setStatus(if #winners > 0 then "Survivors: " .. table.concat(winners, ", ") else "The lava got everyone!")
	task.wait(RESULTS_SECONDS)
	lava.CFrame = lavaStart
end

while true do
	while #Players:GetPlayers() < MIN_PLAYERS do
		setStatus(string.format("Waiting for %d players...", MIN_PLAYERS))
		task.wait(1)
	end
	for seconds = INTERMISSION_SECONDS, 1, -1 do
		setStatus(string.format("Next round in %d", seconds))
		task.wait(1)
	end
	runRound()
end

RoCode builds it in the place you have open in Roblox Studio, on Windows or macOS with a desktop browser; on a phone the button sends the prompt and the link to your computer. Free to start, with free credits every day. More Roblox Studio scripts

Where to put it

Explorer: the map, the lava part and one Script
ServerScriptService
  LavaRounds Script new
Workspace
  Lobby
    SpawnLocation
  LavaMap Model
    MapSpawn Part
    Lava Part
StarterGui
  RoundStatus ScreenGui (Step 4)

Settings you can change

RISE_STUDSIn the script
How far the lava climbs in one round. Make it reach the top of your map. Default: 80.
ROUND_SECONDSIn the script
How long the climb takes. Survivors at the end win. Default: 90.
MIN_PLAYERSIn the script
Players needed to start a round. Set 2 or more for a live game; 1 lets you test alone. Default: 1.

Keep the only SpawnLocation in the lobby: players respawn there after the lava gets them, and the script sends survivors back to it. Only players in the round are checked, so the lobby is always safe.

Type-checked with luau-lsp strict against Roblox's API definitions on 14 November 2026. Not playtested in Studio yet: press Play and watch the Output window before you publish.

Prompt for RoCode

Make a rising lava game: one Script in ServerScriptService that loops rounds. Wait in the lobby for at least 1 player with a 15 second intermission, teleport everyone to the MapSpawn part, reset the Lava part to its start, tween it up 80 studs over 90 seconds, kill any player whose root part is inside the lava every Heartbeat, end early if nobody is left, give survivors 1 Win in leaderstats, teleport them back to the lobby, and show the status in a label at the top of the screen.

On this page
  1. Get the script
  2. How it works
  3. 1. Map
  4. 2. Script
  5. 3. Explained
  6. 4. Status label
  7. 5. Test
  8. Common errors
  9. With RoCode
  10. Questions
  11. Sources

How a rising lava round works

The game is a loop the server repeats forever. Each pass through it is one round:

One round, in order
PhaseWhat happensEnds when
WaitingPlayers stand in the lobby.At least MIN_PLAYERS are in the game.
IntermissionA countdown, so players who just joined can get ready.15 seconds pass.
RoundPlayers are teleported to the map. The lava rises from its start.The lava reaches the top, or everyone is out.
ResultsSurvivors get a Win and go back to the lobby. The lava goes back down.A few seconds pass, then the loop starts again.

This is the same shape as any round-based game. The round system guide builds the loop in a general way; this guide fills it with the lava. For a whole game of different disasters instead of one, see the natural disaster game guide.

Step 1: Build the map and the lava

  1. Build a lobby away from the map, for example 200 studs to the side, and put a SpawnLocation in it. Players spawn and respawn there.
  2. Build the map: towers, ledges and ramps to climb, about 80 studs tall. Group it into a Model named LavaMap.
  3. Inside LavaMap, add an anchored, invisible, non-colliding Part named MapSpawn above the starting floor. Players are teleported onto it.
  4. Add a large, flat Part named Lava inside LavaMap. Make it cover the whole map from edge to edge, set Material to Neon, colour it orange, tick Anchored and untick CanCollide. Put its top surface just below the map's floor.

Step 2: The round Script

  1. Hover over ServerScriptService, click + and insert a Script. Name it LavaRounds.
  2. Paste the code below. Set MIN_PLAYERS to 1 while you test alone.
  3. Press Play and wait for the intermission to count down.
Script in ServerScriptService named LavaRounds
-- Script in ServerScriptService named LavaRounds.
-- Rounds where lava climbs the map. Survivors at the end win.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

local RISE_STUDS = 80 -- how far the lava climbs in one round
local ROUND_SECONDS = 90 -- how long the climb takes
local MIN_PLAYERS = 1 -- players needed to start (use 2 or more in a live game)
local INTERMISSION_SECONDS = 15
local RESULTS_SECONDS = 5

local map = workspace:WaitForChild("LavaMap")
local lava = map:WaitForChild("Lava") :: BasePart
local mapSpawn = map:WaitForChild("MapSpawn") :: BasePart
local lobbySpawn = workspace:FindFirstChildWhichIsA("SpawnLocation", true)

lava.Anchored = true
local lavaStart = lava.CFrame -- saved once: every round resets the lava to this

local inRound: { [Player]: boolean } = {}
local roundActive = false

local function setStatus(text: string)
	-- The RoundStatus LocalScript shows this on every screen
	ReplicatedStorage:SetAttribute("RoundStatus", text)
end

local function getLiveHumanoid(player: Player): (Humanoid?, BasePart?)
	local character = player.Character
	local humanoid = character and character:FindFirstChildOfClass("Humanoid")
	local root = humanoid and humanoid.RootPart
	if humanoid and root and humanoid.Health > 0 then
		return humanoid, root
	end
	return nil, nil
end

local function countAlive(): number
	local count = 0
	for _ in inRound do
		count += 1
	end
	return count
end

local function addWin(player: Player)
	local leaderstats = player:FindFirstChild("leaderstats")
	local wins = leaderstats and leaderstats:FindFirstChild("Wins")
	if wins and wins:IsA("IntValue") then
		wins.Value += 1
	end
end

-- Every frame during a round: anyone inside the lava dies
RunService.Heartbeat:Connect(function()
	if not roundActive then
		return
	end
	local half = lava.Size / 2
	for player in inRound do
		local humanoid, root = getLiveHumanoid(player)
		if humanoid and root then
			local offset = lava.CFrame:PointToObjectSpace(root.Position)
			if math.abs(offset.X) <= half.X and math.abs(offset.Z) <= half.Z and offset.Y <= half.Y then
				humanoid.Health = 0 -- kills through a ForceField too
			end
		end
	end
end)

-- Wins on the player list
local function onPlayerAdded(player: Player)
	if player:FindFirstChild("leaderstats") then
		return
	end
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	local wins = Instance.new("IntValue")
	wins.Name = "Wins"
	wins.Parent = leaderstats
	leaderstats.Parent = player
end
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
	onPlayerAdded(player) -- players who joined while the script waited for the map
end

Players.PlayerRemoving:Connect(function(player: Player)
	inRound[player] = nil
end)

local function runRound()
	-- Reset the lava and send everyone to the map
	lava.CFrame = lavaStart
	table.clear(inRound)
	for index, player in Players:GetPlayers() do
		local humanoid = getLiveHumanoid(player)
		local character = player.Character
		if humanoid and character then
			-- Spread players out a little so they do not land inside each other
			local spread = Vector3.new((index % 4) * 3 - 4.5, 3, math.floor(index / 4) * 3)
			character:PivotTo(mapSpawn.CFrame + spread)
			inRound[player] = true
			humanoid.Died:Once(function()
				inRound[player] = nil
			end)
		end
	end

	local rise = TweenService:Create(lava, TweenInfo.new(ROUND_SECONDS, Enum.EasingStyle.Linear), {
		CFrame = lavaStart + Vector3.new(0, RISE_STUDS, 0),
	})
	rise:Play()
	roundActive = true

	local started = os.clock()
	while os.clock() - started < ROUND_SECONDS and countAlive() > 0 do
		local left = math.ceil(ROUND_SECONDS - (os.clock() - started))
		setStatus(string.format("The lava is rising! %d s left, %d alive", left, countAlive()))
		task.wait(0.25)
	end
	roundActive = false
	rise:Cancel()

	-- Results: survivors win and go back to the lobby
	local winners = {}
	for player in inRound do
		if getLiveHumanoid(player) then
			addWin(player)
			table.insert(winners, player.Name)
			local character = player.Character
			if character and lobbySpawn then
				character:PivotTo(lobbySpawn.CFrame + Vector3.new(0, 4, 0))
			end
		end
	end
	table.clear(inRound)
	setStatus(if #winners > 0 then "Survivors: " .. table.concat(winners, ", ") else "The lava got everyone!")
	task.wait(RESULTS_SECONDS)
	lava.CFrame = lavaStart
end

while true do
	while #Players:GetPlayers() < MIN_PLAYERS do
		setStatus(string.format("Waiting for %d players...", MIN_PLAYERS))
		task.wait(1)
	end
	for seconds = INTERMISSION_SECONDS, 1, -1 do
		setStatus(string.format("Next round in %d", seconds))
		task.wait(1)
	end
	runRound()
end

Step 3: How each part works

Moving the lava

TweenService:Create takes a part, how the motion should go (a TweenInfo with the time and an easing style) and the property values to end at. Enum.EasingStyle.Linear moves the lava at the same speed all the way, 80 studs over 90 seconds, a little under 1 stud per second. A tween on an anchored part moves it smoothly for everyone, because the server owns it and its position replicates.

For lava that rises in steps instead, so players get a pause between each surge, replace the single tween with a loop of short tweens: rise 10 studs over 5 seconds, wait 6 seconds, repeat. The TweenService guide explains easing styles and chaining tweens.

Killing on contact

The Heartbeat check turns each player's position into the lava's own space with PointToObjectSpace. Inside the lava's edges and below its top surface means dead. Setting Health to 0 kills even through a ForceField, so a player who just respawned cannot shrug the lava off. Only players in inRound are checked, so players waiting in the lobby are safe whatever happens.

Ending a round

Each player's Humanoid has a Died handler that removes them from inRound, and leaving the game does the same. The round loop checks the count every quarter of a second and ends as soon as it reaches 0, so a round where everyone falls in early does not leave players waiting. rise:Cancel() stops the tween where it is, and the reset at the start of the next round puts the lava back.

Resetting

lavaStart is saved once, when the server starts. Setting lava.CFrame = lavaStart puts the lava back exactly, however far it rose. If your map has parts that break or move during a round, keep a copy of the map in ServerStorage and swap in a fresh clone at the start of each round the same way.

Step 4: Show the round status

The server writes the status into a RoundStatus attribute on ReplicatedStorage. Attributes set by the server replicate to every player, so a LocalScript can show the text without any RemoteEvent.

  1. In StarterGui, insert a ScreenGui named RoundStatus.
  2. Inside it, insert a LocalScript and paste the code below. It makes the label itself.
LocalScript in the RoundStatus ScreenGui named RoundStatusLabel
-- LocalScript inside a ScreenGui named RoundStatus in StarterGui.
-- Shows the round status the LavaRounds Script writes.
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local gui = script.Parent :: ScreenGui

local label = Instance.new("TextLabel")
label.AnchorPoint = Vector2.new(0.5, 0)
label.Position = UDim2.new(0.5, 0, 0, 12)
label.Size = UDim2.fromOffset(420, 40)
label.BackgroundColor3 = Color3.fromRGB(30, 20, 20)
label.BackgroundTransparency = 0.25
label.TextColor3 = Color3.fromRGB(255, 200, 120)
label.Font = Enum.Font.GothamBold
label.TextSize = 18
label.Parent = gui
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 10)
corner.Parent = label

local function update()
	local status = ReplicatedStorage:GetAttribute("RoundStatus")
	label.Text = if typeof(status) == "string" then status else ""
end

ReplicatedStorage:GetAttributeChangedSignal("RoundStatus"):Connect(update)
update()

The Wins count shows on the player list in the top-right, because the Script puts an IntValue named Wins in a folder named leaderstats. To keep Wins between sessions, save it with the leaderboard script, which does the same leaderstats with a DataStore.

Step 5: Test it

  1. Set ROUND_SECONDS to 20 and INTERMISSION_SECONDS to 5 while testing, so each round is quick.
  2. Press Play. The label counts down, then you are teleported onto the map and the lava starts to climb.
  3. Stand still on the floor: the lava reaches you and you die, and the round ends because no one is left.
  4. Next round, climb ahead of the lava: when the timer ends you go back to the lobby and your Wins goes up by 1.
  5. Start a local server with 2 or 3 players from the Test tab and check that one player dying does not end the round for the others.
  6. Put the values back to 90 and 15 before you publish.

Common errors and fixes

If the round never starts or the lava does not move, check the Output window first: a red line names the script and the line.

Infinite yield possible on LavaMap, Lava or MapSpawn

The script waits for these by name. Check the spelling and that Lava and MapSpawn are inside the LavaMap model. The infinite yield page explains the warning.

The lava does not move

Lava has to be a Part with Anchored on. An unanchored part falls and the tween fights gravity. Also check the round actually started: the label should say the lava is rising.

Players respawn on the map instead of the lobby

There is a SpawnLocation inside the map. Roblox respawns players at a SpawnLocation, and the script also uses the first one it finds as the lobby. Keep only the one in the lobby.

Players survive inside the lava

The lava part is smaller than the map, so players climb outside its edges. Make it cover the whole map, with some margin.

The round never ends

A dead player is still counted. Check the Died:Once line runs for each player teleported in, and that nothing heals players after death.

Build it with RoCode

If you would rather not set this up by hand, RoCode can build it in the place you have open. RoCode is an independent AI agent for Roblox Studio, not made by Roblox: you describe the change in a web chat, and its Studio plugin creates the parts and scripts in your Explorer, so there is no code to paste.

You type

Make a floor is lava game: a lobby, a tall map of platforms to climb, lava that rises in surges every round, a Wins leaderboard, and a status message at the top of the screen.

RoCode does
  • Can read your place first to find your map, then adds the lava part, the lobby spawn and the round Script
  • Writes the scripts with Create Script and is told to compile-check each one with Check Script
  • Sets an undo point before and after each batch of changes, so Ctrl+Z steps back one batch at a time

After a build, RoCode can run its test robot: it plays your game in Studio and reports PASS or FAIL. It checks only what it chose to test, so play a few rounds yourself too. A whole game is a few prompts: how building one system per prompt works. How RoCode connects to Studio.

Questions

How do you make rising lava in Roblox Studio?

Anchor a big Neon part under the map and move it up with TweenService:Create(lava, TweenInfo.new(90, Enum.EasingStyle.Linear), { CFrame = top }). Kill players whose root part is inside it with a check every Heartbeat. Step 2 has the full round Script.

How do I reset the lava each round?

Save lava.CFrame once when the script starts and set it back at the start of every round. Cancel the old tween first if it is still playing.

Why does the lava not kill players who stand still?

A moving anchored part may not fire Touched on a player who is not moving. Check each player's position against the lava every frame instead, as the script does.

How do I make the lava rise faster each round?

Keep a round counter and lower ROUND_SECONDS a little each time, for example math.max(40, 90 - round * 5), when you create the tween.

How do I give survivors a reward?

At the end of the round, loop over the players still alive and add to their Wins or coins in leaderstats. The script gives 1 Win.

Sources and further reading

How the code was checked: every script on this page passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 14 November 2026). A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.

Try RoCode on your own place.

Free every day, no card required. Install the plugin, describe the feature, and review what lands in Studio.