DisListen

Constructor:

DisListen(tarobject,propertyKey)

Description

Cancels the listener of the given property.

Parameter

Name Class Name Description
tarobject RWObject The monitored object.
propertyKey string Property name

Examples

Register the part in the method to monitor the Scale property of the part. After Scale changes, wait for 4 seconds and cancel the specified property that is monitored. Observe whether the listener event is triggered or not.

local part = RWObject.Create("Part") -- create a part
part.Position = Vector3.New(2, 1, 0) -- assign a vector to the part position
local function handle(property, value, newValue, objectName, objectClassName) -- define a method of property changing
    print("property " .. property .. " Value Changed")
end
PropertyWatcherService.ListenPropertyChange(part, "Scale", handle) -- register the event that the part property changes
part.Scale = Vector3(0.5,0.5,0.5) -- assign a vector to the part Scale property
wait(4) -- wait 4
PropertyWatcherService.DisListen(part,"Scale") -- remove the event that the part property changes
wait(1) -- wait 1
part.Scale = Vector3(0.3,0.3,0.3) -- assign a vector to the part Scale property