Lava blocks and checkpoints
Now your obby becomes a real game: lava blocks send players back, checkpoints remember their progress.
What you’ll learn
- script a lava block (kill brick)
- build checkpoints with SpawnLocation and RespawnLocation
- put scripts directly into a part
Lava block
Put this Script directly into the part (click + next to the part in the Explorer). script.Parent is then the part itself. Make it neon red so players see the danger.
local brick = script.Parent
brick.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health = 0 -- back to the last checkpoint
end
end)Checkpoints
Insert another SpawnLocation as a checkpoint and put this Script inside it. Whoever touches it respawns there from then on:
local checkpoint = script.Parent -- a SpawnLocation
local Players = game:GetService("Players")
checkpoint.Touched:Connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player then
player.RespawnLocation = checkpoint
end
end)Fair games
Make the first jumps easy and increase the difficulty slowly. A checkpoint before every hard part keeps players happy – just like in our Block Parkour.
🛠️ Try it
Add two lava blocks and a checkpoint in the middle of your obby. Test: after the lava, do you respawn at the checkpoint?
🧠 Mini quiz
What is script.Parent when the Script is inside a part?
Parent is the object something is inside – here the part.
What does humanoid.Health = 0 do?
At 0 health the character respawns at the spawn or checkpoint.
✓ Lesson done! On to the next one.
Roblox and Roblox Studio are trademarks of the Roblox Corporation. mahshid.de is not affiliated with Roblox. All links to Roblox lead to the official sites.