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

Negative money Reset Not Work ?

Asked by 10 years ago

Well Can You Help Me Why This wont Work ? This The Script , Its' On starter gui , Screen Gui , Script

if script.Parent.Parent.Parent.leaderstats.Cash.Value == -2147483648 then
    script.Parent.Parent.Parent.leaderstats.Cash.Value = 250000000
end
0
Theres nothing wrong with that bit of code, but how you use it may effect something. And why such a specific number? Elaborate the question a bit. Include more of the script please. Goulstem 8144 — 10y
0
Actually, 250000000 might be too high. l0cky2013 135 — 10y

1 answer

Log in to vote
3
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

-snip-

If you want to check if a number is negative, check if it is less than 0:

if script.Parent.Parent.Parent.leaderstats.Cash.Value < 0 then
    script.Parent.Parent.Parent.leaderstats.Cash.Value = 2147483647 --You were right about that being too big, by the way.
end

Honestly, though, you should just use sane values so you don't have to deal with integer wrapping, or just use Strings.

0
Normal scripts **do** run in the PlayerGui. (just verified to be sure) BlueTaslem 18071 — 10y
0
Weird. Every time I've tried they haven't worked. Ah well. (People still *should* use LocalScripts in the PlayerGui, though) adark 5487 — 10y
Ad

Answer this question