Here's the script:
function onPlayerEntered(newPlayer)
if newPlayer.Character.Humanoid.Health == 0
then
newPlayer.leaderstats.Lives.Value = newPlayer.leaderstats.Lives.Value - 1
end
end
game.Players.PlayerAdded:connect(onPlayerEntered)
But then if I do
function onPlayerEntered(newPlayer)
wait(1)
newPlayer.leaderstats.Lives.Value = 5
end
game.Players.PlayerAdded:connect(onPlayerEntered)
to test if my function is working correctly, it does. But then my actual script won't work when I kill my player. Am I missing something here?
(Sorry if this is a stupid mistake or bad question, i'm new to lua.)

1 comment
Did you set up the leaderstats, or the lives value yet? When you set them up, were they capitalized?