Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Obby = {}
- local Checkpoints = workspace:WaitForChild("Checkpoints")
- Obby.RespawnTime = 3
- function Obby.Setup()
- local SpawnL = Instance.new("SpawnLocation", workspace)
- SpawnL.Neutral = true
- SpawnL.Anchored = true
- SpawnL.CanCollide = false
- SpawnL.Enabled = true
- local Sp = Checkpoints:WaitForChild("Spawn")
- SpawnL.CFrame = Sp.CFrame
- SpawnL.Size = Sp.Size
- SpawnL.TopSurface = "Smooth"
- Sp:Destroy()
- end
- function Obby.TeleportPlayer(player)
- wait(Obby.RespawnTime)
- player:LoadCharacter()
- local character = player.Character
- if player.CurrentCheckpoint.Value > 0 then
- character.HumanoidRootPart.CFrame = Checkpoints:FindFirstChild(player.CurrentCheckpoint.Value).CFrame + Vector3.new(0, 5, 0)
- end
- end
- function Obby.CheckpointTouched(hit, cpNum)
- if game.Players:FindFirstChild(hit.Parent.Name) then
- if cpNum > game.Players:FindFirstChild(hit.Parent.Name).CurrentCheckpoint.Value then
- game.Players:FindFirstChild(hit.Parent.Name).CurrentCheckpoint.Value = cpNum
- end
- end
- end
- return Obby
Advertisement
Add Comment
Please, Sign In to add comment