game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player) local char = player.Character local hum = char:WaitForChild("Humanoid")
hum.Health = 0 end)
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player) local char = player.Character local hum = char:WaitForChild("Humanoid")
hum.Health = 0 end)
Try this out.
game.ReplicatedStorage:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(player)
local PlayerCharacter = player.Character
if not PlayerCharacter then
repeat wait() until PlayerCharacter
local PlayerHumanoid = PlayerCharacter.Humanoid
PlayerHumanoid.Health = 0
else
local PlayerHumanoid = PlayerCharacter.Humanoid
PlayerHumanoid.Health = 0
end
end)
-1. No explanation was given. And for polling.
@programmerHere ok? lol
my laptop where i normaly make games on is charging. i will try this when its charged
won't work ;-;
Your script:
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player) -- Always use waitforchild
local char = player.Character
local hum = char:WaitForChild("Humanoid")
hum.Health = 0
end)
Edited Script:
game.ReplicatedStorage:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(player)
local char = player.Character
local hum = char.WaitForChild("Humanoid")
if hum then
wait()
hum.Health = 0
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Use a close block plz next time
and maybe an output this should work