Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Obby = require(script.Parent.ObbyModule)
- local Checkpoints = workspace:WaitForChild("Checkpoints"):GetChildren()
- Obby.Setup()
- game.Players.PlayerAdded:Connect(function(player)
- local cp = Instance.new("IntValue", player)
- cp.Name = "CurrentCheckpoint"
- cp.Value = 0 -- Current checkpoint will be spawn
- local character = player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- humanoid.Died:Connect(function()
- Obby.TeleportPlayer(player)
- end)
- for _, Checkpoint in pairs(Checkpoints) do
- Checkpoint.Touched:Connect(function(hit)
- Obby.CheckpointTouched(hit, Checkpoint.CPNum.Value)
- end)
- end
- end)
Add Comment
Please, Sign In to add comment