Advertisement
tobik_roblox

Spawn script

Aug 6th, 2024 (edited)
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. local SpawnLocation = script.Parent
  2. local player
  3. SpawnLocation.Touched:Connect(function(hit)
  4. if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(hit.Parent.Name):FindFirstChild("leaderstats") and game.Players:FindFirstChild(hit.Parent.Name).leaderstats.Stage.Value ~= 1 then
  5. player = game.Players:FindFirstChild(hit.Parent.Name)
  6. local Stage = player.leaderstats:WaitForChild("Stage").Value
  7. local Checkpoint = SpawnLocation.Parent:WaitForChild("Checkpoint"..Stage)
  8. hit.Parent:WaitForChild("HumanoidRootPart").CFrame = Checkpoint.CFrame + Vector3.new(0,3,0)
  9. print(player.Name.." Was Teleported to Checkpoint"..player.leaderstats.Stage.Value)
  10. end
  11. end)
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement