Collapse Sidebar


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

See also

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


Name Type Default Description

The value after the change

Code Samples

How to Use RayValue.Changed

The below example, assuming all referenced objects existed, would print the RayValue’s new value each time it changed. In the example below it would print “{0, 0, 0}, {0.577350199, 0.577350199, 0.577350199}”.

local value = Instance.new("RayValue")
value.Parent = game.Workspace


local start = Vector3.new(0,0,0)
local lookAt = Vector3.new(10,10,10)
local ray = Ray.new(start, (lookAt - start).unit)
value.Value = ray