I've wanted to make a script which the player's leaderstats can only go up, and if it goes down, it'll go back to the original value. I just wanted to know what I can use and where I can start...
COMMUNITY QUESTION
Is there a way to prevent leaderstats going down?
1 answer
Using GetPropertyChangedSignal you can compare both the new and old values and work accordingly. If the new value is less than the old, set the value to the old.
local lastValue = statistic.Value
statistic:GetPropertyChangedSignal("Value"):connect(function()
if (statistic.Value < lastValue) then
statistic.Value = lastValue
return
end
lastValue = statistic.Value
end)
2 comments
0
So... is this a Local Script or a Script? Where do I put this...
0
obviously a server script.... set statistic = to the IntValue/NumberValue you want to track
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
.Changed event, operators, and if else statements.