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

When do we use Number Values or a Int Value?

Asked by 5 years ago

So lets talk about values.There is string ( text message ) bool ( true or false ) int ( usually a number or leaderstats but sometimes used to store numbers ) and number value i pretty much never see anyone use this type and they use int idk the difference of the 2 but what i do know is that they both store numbers but WHATS THE DIFFERENCE? WHEN DO WE USE THEM AND WHY???

0
That question you marked and voted on as a duplicate has a really bad answer. Avigant 2374 — 5y

1 answer

Log in to vote
2
Answered by
Avigant 2374 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

IntValues store a 32-bit signed integers as their values. Ssigned means that it can represent negative numbers. 32-bit means that that's how many bits are used to represent the number (there are eight bits in a byte). If you add 1 to the maximum value of an IntValue, which is 2,147,483,647, it will wrap around to the minimum value, which is -2,147,483,648. Being an integer, it does not allow us to represent fractions.

NumberValue objects store 64-bit doubles as their values. This means that they can represent much bigger numbers than IntValues, and that they can be used to represent fractions.

If you need to represent a fraction or a very large number, use a NumberValue. But if you don't, just an IntValue is fine.

Ad

Answer this question