rojo/.cursor/rules/roblox/reference/engine/classes/IntValue.yaml
2026-02-02 12:08:47 -06:00

97 lines
3.1 KiB
YAML

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: IntValue
type: class
memory_category: Instances
summary: |
A container object for a single integer.
description: |
Stores a single signed [64-bit integer](../../../luau/numbers.md#int64). 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](https://en.wikipedia.org/wiki/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](../../../studio/properties.md) 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 `Class.NumberValue` instead.
Like all `Class.ValueBase` objects, this single value is stored in the
`Class.IntValue.Value|Value` property. The `Changed` event fires with the new
value being stored in the object, instead of a string representing the
property being changed.
code_samples: []
inherits:
- ValueBase
descendants: []
tags: []
deprecation_message: ''
properties:
- name: IntValue.Value
summary: |
Used to hold an integer.
description: |
Used to hold an integer.
code_samples: []
type: int64
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities: []
methods: []
events:
- name: IntValue.Changed
summary: |
Fires whenever the `Class.IntValue.Value` is changed.
description: |
Fires whenever the `Class.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.
code_samples:
- IntValue-Changed1
parameters:
- name: value
type: int64
default:
summary: |
The new value after the change.
tags: []
deprecation_message: ''
security: None
capabilities: []
- name: IntValue.changed
summary: ''
description: ''
code_samples: []
parameters:
- name: value
type: int64
default:
summary: ''
tags:
- Deprecated
deprecation_message: |
This deprecated event is a variant of `Class.IntValue.Changed` which
should be used instead.
security: None
capabilities: []
callbacks: []