Vital.sandbox
Model

self:set_component_visible

Shared

Toggles the visibility of one or more components on the model


Syntax

local status = self:set_component_visible(component, state)

Parameters

TypeNameDescription
stringcomponentPath of the component to update
Supports * as a wildcard to match multiple components by pattern
boolstateDetermines the component's visibility:
• When true - the component is shown
• When false - the component is hidden

Returns

TypeNameDescription
boolstatustrue on successful execution, or false on failure

Examples

Toggle various component's visibility on a model
local entity = model.create("character")

--Show the hat
entity:set_component_visible("Skeleton3D/Hat", true)

--Hide the hat
entity:set_component_visible("Skeleton3D/Hat", false)

--Hide all hats at once using a wildcard
entity:set_component_visible("Skeleton3D/Hat_*", false)

--Show only Hat_1
entity:set_component_visible("Skeleton3D/Hat_1", true)

On this page