An IntValue is an object that stores a single signed 64-bit integer. Integers do not include decimal points. The highest value that can be stored is 2^63-1, or around 9.2 quintillion. Attempting to store numbers larger than this may cause integer overflow. The lowest value that can be stored is -2^63, or about negative 9.2 quintillion. For values outside of this range, use a NumberValue instead. Like all "-Value" objects, this single value is stored in the Value property. The IntValue.Changed event for this (and other objects like it) will run with the new value being stored in the object, instead of a string representing the property being changed.
-- These are the constraints for a 32-bit signed integerlocal INT_MAX = 2 ^ 31 - 1local INT_MIN = -(2 ^ 31)local vInteger = Instance.new("IntValue")vInteger.Changed:Connect(print)-- Some small valuesvInteger.Value = 5vInteger.Value = 0vInteger.Value = -0 -- No change - same as 0-- Min valuevInteger.Value = INT_MIN-- Max valuevInteger.Value = INT_MAX-- Max value plus one; this causes integer overflow!-- The IntValue changes to INT_MIN!vInteger.Value = INT_MAX + 1
Fired whenever the IntValue.Value of the IntValue is changed.
Used to hold an integer.
The Changed event fires whenever the IntValue.Value of the IntValue is changed. It will run with the new value being stored in the argument object, instead of a string representing the property being changed.
This event, like other changed events, can be used to track when an IntValue changes and to track the different values that it may change to.
For instance, this may be useful in games that rely on IntValues to track game states and values, such as item IDs.
Equivalent changed events exist for similar objects, such as NumberValue and StringValue, depending on what object type best suits the need.
The new value after the change.
local value = Instance.new("IntValue")value.Parent = workspacelocal function onValueChanged(newValue)print(newValue)endvalue.Changed:Connect(onValueChanged)value.Value = 20