sethiddenproperty Synchronous

  • sethiddenprop

Write a reflected property and report whether its native descriptor is hidden. Use it only when you know the property and value expected by that Instance class.

Syntax
Luau
sethiddenproperty(instance: Instance, property: string, value: any) -> boolean

Parameters

Function parameters
ParameterTypeDescription
instanceInstanceInstance whose reflected property will be written.
propertystringCase-sensitive property name.
valueanyNew value of the property’s native type.

Returns

boolean

A boolean indicating whether the property’s native descriptor is hidden; it does not report whether the value changed.

Usage notes

An unknown, protected, or incompatible property raises an error. Save and restore a previous value if the change is temporary.

Example

Example
Luau
local part = Instance.new("Part")
local before = part.CanCollide
local ok, hidden = pcall(sethiddenproperty, part, "CanCollide", false)
if ok then
    print("Native property hidden:", hidden)
    part.CanCollide = before
end
part:Destroy()
Kawaii documentation