Facebook
From Харітон, 1 Week ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 176
  1. local spawn = script.Parent
  2.  
  3. spawn.Touched:connect(function(hit)
  4.  
  5. if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
  6.  
  7. local player = game.Players:GetPlayerFromCharacter(hit.Parent)
  8.  
  9. local checkpointData = game.ServerStorage:FindFirstChild("CheckpointData")
  10.  
  11. if not checkpointData then
  12.  
  13. checkpointData = Instance.new("Model", game.ServerStorage)
  14.  
  15. checkpointData.Name = "CheckpointData"
  16.  
  17. end
  18.  
  19. local checkpoint = checkpointData:FindFirstChild(tostring(player.userId))
  20.  
  21. if not checkpoint then
  22.  
  23. checkpoint = Instance.new("ObjectValue", checkpointData)
  24.  
  25. checkpoint.Name = tostring(player.userId)
  26.  
  27. player.CharacterAdded:connect(function(character)
  28.  
  29. wait()
  30.  
  31. character:WaitForChild("HumanoidRootPart").CFrame =
  32. game.ServerStorage.CheckpointData[tostring(player.userId)].Value.CFrame + Vector3.new(0, 4, 0)
  33.  
  34. end)
  35.  
  36. end
  37.  
  38. checkpoint.Value = spawn
  39.  
  40. end
  41.  
  42. end)