game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) if char.Humanoid.Health < 1 then plr.data.tp.Value = 0 end end) end)
Greetings, thank you for your post on Scripting Helpers.
Problem:
Your script is probably located in the incorrect place, if it is in StarterPlayer, you should move it to StarterCharacter. In StarterPlayer is will only run when you join.
How to solve:
Put the script in StarterCharacter.
Hope this works, -ecoszns
I see what the problem is. After the CharacterAdded function, add a wait(2) as a cooldown for the character and its children to load in. Like this:
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) wait(2) -- cooldown if char.Humanoid.Health < 1 then plr.data.tp.Value = 0 end end) end)
This error happens many times. You can't detect the health of the humanoid if it hasn't loaded in yet.