setscriptable Synchronous
Override the effective scriptability of one reflected property. It returns the previous state, making temporary changes easy to restore.
Luau
setscriptable(instance: Instance, property: string, enabled: boolean) -> boolean?Parameters
| Parameter | Type | Description |
|---|---|---|
instance | Instance | Instance whose property visibility is being changed. |
property | string | Case-sensitive reflected property name. |
enabled | boolean | Boolean state to apply. |
Returns
boolean?The previous scriptability flag, or nil when the property does not exist.
Usage notes
Changing scriptability does not itself read or write the property. Restore the previous flag after temporary inspection.
Example
Luau
local part = Instance.new("Part")
local before = setscriptable(part, "CanCollide", true)
if before ~= nil then
print("Now scriptable:", isscriptable(part, "CanCollide"))
setscriptable(part, "CanCollide", before)
end
part:Destroy()