sethiddenproperty Synchronous

  • sethiddenprop

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

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

Parameters

Function parameters
ParameterTypeDescription
instanceInstance | ObjectInstance or Roblox Object 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()