HowToRoblox

ReviveServer

May 28th, 2022 (edited)
1,904
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. game.Players.PlayerAdded:Connect(function(p)
  2.    
  3.     p.CharacterAdded:Connect(function(c)
  4.        
  5.         c:WaitForChild("Humanoid").HealthChanged:Connect(function(health)
  6.            
  7.             if health <= 1 and not c:FindFirstChild("Revived") then
  8.                
  9.                 c.Humanoid.MaxHealth = math.huge
  10.                 c.Humanoid.Health = math.huge
  11.                
  12.                 c.HumanoidRootPart.Anchored = true
  13.                
  14.                
  15.                 local proximityPrompt = Instance.new("ProximityPrompt")
  16.                 proximityPrompt.HoldDuration = 5
  17.                 proximityPrompt.ActionText = "Hold E to Revive"
  18.                 proximityPrompt.ObjectText = c.Name .. "'s corpse"
  19.                 proximityPrompt.RequiresLineOfSight = false
  20.                 proximityPrompt.Parent = c.HumanoidRootPart
  21.                
  22.                 game.ReplicatedStorage:WaitForChild("ReviveRE"):FireClient(p, proximityPrompt)
  23.                
  24.                
  25.                 proximityPrompt.Triggered:Connect(function(plr)
  26.                    
  27.                     local revived = Instance.new("BoolValue", c)
  28.                     revived.Name = "Revived"
  29.                    
  30.                     proximityPrompt.Enabled = false
  31.                     proximityPrompt:Destroy()
  32.                    
  33.                     c.Humanoid.MaxHealth = 100
  34.                     c.Humanoid.Health = c.Humanoid.MaxHealth
  35.                     c.HumanoidRootPart.Anchored = false
  36.                    
  37.                     game.ReplicatedStorage:WaitForChild("ReviveRE"):FireClient(p)
  38.                 end)
  39.                
  40.                
  41.                 wait(20)
  42.                
  43.                 if not c:FindFirstChild("Revived") then
  44.                    
  45.                     local revived = Instance.new("BoolValue", c)
  46.                     revived.Name = "Revived"
  47.                    
  48.                     c.Humanoid.Health = 0
  49.                 end
  50.             end
  51.         end)
  52.     end)
  53. end)
Add Comment
Please, Sign In to add comment