Ive been working at this for the past four hours, and I cant get this to work. So here I am.
So I have been working on a game that requires a death screen. So I made one, problem is that it doesn’t work. I have tried finding the player’s health and seeing when it turns to 0, that doesn’t work:
--client side
workspace[game.Players.LocalPlayer.Name].Humanoid:GetPropertyChangedSignal('Health'):Connect(function()
local health = workspace[game.Players.LocalPlayer.Name].Humanoid.Health
print(health)
if health == 0 and workspace.night.Value == true then
--not important, but works
elseif health ~= 0 and workspace.night.Value == true and health ~= 100 then
--not important, but works
elseif health == 0 and workspace.night.Value == false then
print("does this even work")
--doesnt work, doesn't even print.
end)
Then I tried to use the .Died thing, but that also didn’t work (I deleted the code)
Then I treid to send a remote event thing to the player that has died, but, you guessed it! It also doesn’t work:
Here is the server side script:
status = 'workyouidiot'
remoteeve:FireAllClients(status)
Here is the client side script:
local gameupdate = game.ReplicatedStorage:WaitForChild("update")
gameupdate.OnClientEvent:Connect(function(status)
if status == 'workyouidiot' then
print("status")
--rest of the script
end
end)
It doesn’t print, or run the rest of the script.
What confused me is the health thing at the top, it works. Even the part that doesn’t work, it works. Only sometimes. It works when the server doesn’t set their health to zero. When a player dies from another player, it works, when a player gets their health set to zero by another script, it works. Just when a player gets their health set to zero by this specific script, it doesn’t work.
Please help