Volt

setscriptable

Sets whether a property is scriptable.

Syntax

setscriptable(instance: Instance, property: string, scriptable: boolean) -> boolean

Parameters

ParameterTypeDescription
instanceInstanceThe instance
propertystringThe property name
scriptablebooleanThe new scriptability

Returns

TypeDescription
booleanThe previous scriptability

Description

setscriptable changes whether a property is accessible through normal scripting. This can make hidden properties accessible via regular property access.

Example

local part = Instance.new("Part")

-- Make a hidden property scriptable
local wasScriptable = setscriptable(part, "size_xml", true)

-- Now we can access it normally
print(part.size_xml)

-- Restore original state
setscriptable(part, "size_xml", wasScriptable)

Making Hidden Properties Accessible

local function exposeProperty(instance, propName)
    local wasScriptable = setscriptable(instance, propName, true)
    return function()
        setscriptable(instance, propName, wasScriptable)
    end
end

-- Use
local restore = exposeProperty(part, "size_xml")
print(part.size_xml) -- Now accessible
restore() -- Restore original state

On this page