I have been working on the script for a little while and I can get the lives to change but it changes the second the game starts and keeps counting down instead of only by 1 when they die. Any ideas guys. Here is the script for further inspection.
game.Players.PlayerAdded:connect(function(plr)
local Stats = Instance.new('IntValue', plr)
Stats.Name = 'leaderstats'
local Lives = Instance.new('IntValue', Stats)
Lives.Name = 'Lives'
Lives.Value = 25
local Stage = Instance.new('IntValue', Stats)
Stage.Name = 'Stage'
Stage.Value = 1
local Timer = Instance.new('IntValue', Stats)
Timer.Name = 'Time'
Timer.Value = 0
while true do
wait(1)
Timer.Value = Timer.Value +1
if game.Players.LocalPlayer.Character.Humanoid.died
then do
Lives.Value = Lives.Value -1
end end end end)
Any help would be appreciated. I can't seem to understand why it's not working. I was referencing the wiki but to no luck.

1 comment
Thank you for the explanation it really helps to understand now!