Class
IntValue
A container object for a single integer.
Stores a single signed 64-bit integer. The highest allowed value is 2^63-1 or around 9.2 quintillion (9.2^18). Attempting to store larger numbers causes an integer overflow. The lowest allowed value is -2^63. Practically, however, working with integers larger than 2^53 (9^15) causes loss of precision since Luau uses double-precision floating-point to store numbers.
It's possible to store values between 2^53 and 2^63-1 using the Properties window since it uses strings to pass data to the engine, but manipulating large values via Luau scripts results in loss of precision and rounding as mentioned above.
The main advantage of using IntValue lies in its rounding of values to the
nearest integer, with halfway cases rounded away from 0. For values outside of
this range, use NumberValue instead.
Like all ValueBase objects, this single value is stored in the
Value property. The Changed event fires with the new
value being stored in the object, instead of a string representing the
property being changed.
Properties 1#
Valueint64 | Used to hold an integer.ReadSafe |
Value: int64#
ReadSafe
Used to hold an integer.
Events 2#
| Changed | Fires whenever the IntValue.Value is changed. |
| changed | Deprecated |
Changed(value: int64)#
Fires whenever the IntValue.Value changes. It runs with the new
value being stored in the argument object, instead of a string
representing the property being changed.
Listening for the Changed signal can be useful in games that use
IntValues to track values like leaderboard statistics or item prices.
| Name | Type | Default | Description |
|---|---|---|---|
value | int64 | The new value after the change. |
changed(value: int64)#
DeprecatedDeprecated
Deprecated. This deprecated event is a variant of IntValue.Changed which
should be used instead.
| Name | Type | Default | Description |
|---|---|---|---|
value | int64 |
Inherited members#
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild