Reflection

setscriptable

Changes whether a property is scriptable and returns the previous state.

Syntax

setscriptable(instance: userdata, property: string, value: boolean): boolean

Arguments

NameTypeDescription
instanceuserdataRoblox instance to inspect or update.
propertystringProperty name to read or change.
valuebooleanNew value to write.

Returns

NameTypeDescription
previousStatebooleanPrevious scriptable state before the change.

Description

Changes whether a property is scriptable and returns the previous state.

Call it with 3 parameter(s): instance, property, value. The argument table explains which values are required and which ones only refine the behavior.

It returns previousState (boolean). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Example call with placeholder values.

local result = setscriptable(game, "example", true)
print(result)