i have a script which takes away 1 life ("Lives" is a leaderstat in my game) when a player dies, but i need to make it revert the players stage back to 1 and give them 25 lives again when their Lives are at 0. heres the code i tried (in serverscriptservice)
--variables
local player = game.Players.LocalPlayer
local lives = player.leaderstats.Lives
local stage = player.leaderstats.Stage
if player.lives.Value < 1 then
lives.Value = lives.Value + 25
stage.Value = 1
end
thanks

1 comment
Your if statement is fine, but you need to run that check every time the lives are updated, currently it's only being checked once when the script runs then never again. Also, LocalPlayer doesn't exist on the server. If something isn't working you should look for errors (red text) in output. You might also be interested in checking out the PlayerAdded event.