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

How to compare IntValues

Asked by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

I was wondering how to use the '>=' on an IntValue. Here's part of my script...

if not ra.Value >= 3000 or ca.Value >= 3000 then

'ra' and 'ca' are both IntValues. I tried doing it with NumberValues, but it didn't work. Help?

1
If it didn't work that would mean ra or ca's values weren't more than or equal to 3,000 when the script got to that point. What you are doing there is correct. User#2 0 — 10y
0
According to Roblox Error Monitoring System, it says that I'm attempting to compare a number with a bool Shawnyg 4330 — 10y
0
Then that means your values are BoolValues, or you had the wrong line number. User#2 0 — 10y
0
I'm positive everything is correct Shawnyg 4330 — 10y

1 answer

Log in to vote
6
Answered by 10 years ago

The problem is that ROBLOX thought that you were saying "if (not ra.Value) >= 3000 [...]" To fix it, simply add parenthesis like so:

if not (ra.Value >= 3000) or ca.Value >= 3000 then

end
0
Thanks! Shawnyg 4330 — 10y
Ad

Answer this question