Hello, So I am trying to find out how to tell when the players health is at 0 so it kicks them this is my code so far
if game.Players.LocalPlayer.Character.Humanoid.Health = 0 then
print("hi")
end
but it doesnt seem to work, how is a way to tell if its at 0 this is in a local script by the way and also the print hi was just for testing to see if it even worked, any info on how to do this would be appreciated.
local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
Before the script so that it waits until the humanoid exists or is found. Your script gives an error because scripts (especially server scripts) run as fast as they can once they are loaded.
if it is a server script then yes. I would say put the script in StarterPlayer > StarterCharacterScripts so the script will load with the player’s character so you don’t need to make it too complicated.