PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Changed

This event fires whenever the ObjectValue/Value property 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 ObjectValue changes and to track the different values that it may change to.

For instance, this even may be useful in games that rely on ObjectValues to track game states and values, such as RPG targeting systems.

See also

Equivalent changed events exist for similar objects, such as NumberValue and StringValue, depending on what object type best suits the need.

Parameters

Name Type Default Description

The value after the change


Code Samples


ObjectValue Changed

The below example, assuming all referenced objects existed, would print the name of the newly referenced instance when the ObjectValue’s ObjectValue/Value|value property is changed. In the case below, it would print Part1.

local function printValue(value)
	print(value.Name)
end

Workspace.ObjectValue.Changed:Connect(printName)

Workspace.ObjectValue.Value = Workspace.Part1