Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Anyone know how to lower or change leaderstat max value?

Asked by 6 years ago
Edited 6 years ago

Like this when, The max value reach, it will stop adding value it remains the same.

I try like this and nothing happens lol anyone know please help thanks!

1 while wait(1) do

2 if (player.leaderstats.Money.Value > 1100)then

3 player.leaderstats.Money.Value = 1100

4 end

5 end

First time to post here haha

2 answers

Log in to vote
1
Answered by 6 years ago

Please use code blocks. And wrap this in a changed event.

local money = player.leaderstats.Money

money.Changed:Connect(function(prop)
    if money.Value > 1100 then
        money.Value = 1100
    end
end)
Ad
Log in to vote
1
Answered by 6 years ago

There’s a useful thing called “break” which allows you to break and stop a loop.

Here’s an example on how to use it :

a = 0

while wait(1) do
     if a >= 10 then
          break
     else
          a = a + 1
     end
end

This script adds up a value by 1, and when it gets to 10 or more, it breaks. Otherwise it keeps adding up. Also note that “break” must be IN the loop to work.

Answer this question