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

97 lines
3 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: ObjectValue
type: class
memory_category: Instances
summary: |
A container object for a reference to another instance.
description: |
Stores a single reference to another object. If this object is duplicated
within Studio and the value refers to an object also being copied, then the
new `ObjectValue` points to the copied object instead of the original.
Otherwise, the same value is kept. Copying and pasting this object clears the
value field.
You can set the value within Studio like other reference-type fields (such as
`Class.Model.PrimaryPart`): click the field within the Properties window, then
click the object you wish to set it to within the game view or Explorer
window. You can clear the field (set it to `nil`) by clicking the X that
appears when you click the field.
Like all `Class.ValueBase` objects, this single value is stored in the
`Class.ObjectValue.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.
If [streaming](../../../workspace/streaming.md) is enabled, the `Value`
property is nil until the referenced object streams in, at which point the
`Changed` event fires.
code_samples:
- ObjectValue-Example
inherits:
- ValueBase
descendants: []
tags: []
deprecation_message: ''
properties:
- name: ObjectValue.Value
summary: |
Holds a reference to an instance.
description: |
Holds a reference to an instance.
code_samples: []
type: Instance
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities: []
methods: []
events:
- name: ObjectValue.Changed
summary: |
Fires whenever the `Class.ObjectValue.Value` is changed.
description: |
Fires whenever the `Class.ObjectValue.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
`ObjectValues` to track game state, such as an RPG targeting system.
code_samples:
- ObjectValue-Changed1
parameters:
- name: value
type: Instance
default:
summary: |
The new value after the change.
tags: []
deprecation_message: ''
security: None
capabilities: []
- name: ObjectValue.changed
summary: ''
description: ''
code_samples: []
parameters:
- name: value
type: Instance
default:
summary: ''
tags:
- Deprecated
deprecation_message: |
This event is a deprecated variant of `Class.ObjectValue.Changed` which
should be used instead.
security: None
capabilities: []
callbacks: []