Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

When do we use Number Values or a Int Value?

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???

2 comments

0

That question you marked and voted on as a duplicate has a really bad answer.

1 answer

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.