Advertisement
Guest User

Roblox Checkpoint script!!

a guest
Aug 20th, 2021
3,336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. local checkpoints = workspace:WaitForChild("Checkpoints")
  2.  
  3. game.Players.PlayerAdded:Connect(function(player)
  4.     local leaderstats = Instance.new("Folder")
  5.     leaderstats.Name = "leaderstats"
  6.     leaderstats.Parent = player
  7.  
  8.     local stage = Instance.new("IntValue")
  9.     stage.Name = "Stage"
  10.     stage.Value = 1
  11.     stage.Parent = leaderstats
  12.  
  13.     player.CharacterAdded:Connect(function(char)
  14.         local hum = char:WaitForChild("Humanoid")
  15.         wait()
  16.         char:MoveTo(checkpoints[stage.Value].Position)
  17.  
  18.         hum.Touched:Connect(function(hit)
  19.             if hit.Parent == checkpoints then
  20.                 if tonumber(hit.Name) == stage.Value + 1 then
  21.                     stage.Value = stage.Value + 1
  22.                 end
  23.             end
  24.         end)
  25.     end)
  26. end)
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement