Advertisement
ryanswagg20

Spawn Delay

Oct 8th, 2016
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. -- FadedBedey
  2. SpawnDelay = 1 -- Delay of when died, For example you will respawn 1 second after you die.
  3. OnDeathDo = function(player)
  4. end
  5. game.Players.CharacterAutoLoads = false
  6. game.Players.PlayerAdded:connect(function(p)
  7. p.CharacterAdded:connect(function(c)
  8. local t = time()
  9. while ((not c:FindFirstChild("Humanoid")) and ((time()-t) < 10)) do wait(0.2) end
  10. if ((time()-t) >= 10) then print("Timed Error")
  11. else
  12. c.Humanoid.Died:connect(function()
  13. if (type(OnDeathDo) == "function") then OnDeathDo(p) end
  14. wait(SpawnDelay)
  15. p:LoadCharacter(true)
  16. end)
  17. end
  18. end)
  19. wait(2)
  20. p:LoadCharacter(true)
  21. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement