Check propertie status (Is it hidden or active)

I want to make a system for setting up Constraints elements using GUI, when selecting an element, the script checked which elements are enabled and which are disabled.

For example, I’ll take AlignOrientation, by default it has PrimaryAxisOnly turned off, and if you turn it on, a new AlignType element appears. If you using a script, you can change the value of AlignType without turning on PrimaryAxisOnly.

How can I tell if AlignType is enabled or disabled (without creating new elements or table)?


1 Like
if AlignOrientation.AlignType ~= nil
2 Likes

Since it’s hidden when the PrimaryAxisOnly is set to false then you can use that.

function CheckAlignOrientation(inst:AlignOrientation)
	return inst.PrimaryAxisOnly
end

A property ~= nil even if it’s hidden (Enum only, there may be exceptions)

1 Like