Advertisement
HowToRoblox

RespawnGuiScript

Feb 18th, 2020
4,626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. local plrs = game.Players
  2.  
  3. plrs.CharacterAutoLoads = false
  4.  
  5.  
  6. local respawnTime = 5
  7.  
  8.  
  9. plrs.PlayerAdded:Connect(function(plr) 
  10.    
  11.     plr.CharacterAdded:Connect(function(char)
  12.        
  13.         char:FindFirstChild("Humanoid").Died:Connect(function()
  14.                    
  15.             plr.PlayerGui.RespawnGui.Background.RespawnTime.Text = "Respawning in " .. respawnTime .. " seconds..."
  16.            
  17.             plr.PlayerGui.RespawnGui.Background.Visible = true
  18.            
  19.            
  20.             for i = respawnTime, 0, -1 do  
  21.                
  22.                 plr.PlayerGui.RespawnGui.Background.RespawnTime.Text = "Respawning in " .. i .. " seconds..."
  23.                
  24.                 wait(1)    
  25.             end
  26.            
  27.             plr.PlayerGui.RespawnGui.Background.Visible = false
  28.            
  29.             plr:LoadCharacter()
  30.                
  31.         end)       
  32.     end)
  33.    
  34.     plr:LoadCharacter()
  35. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement