Name: State Switcher
By AdamO on Discord
Created and demonstrated on a stream here - https://youtu.be/unOL6WvKl7M?t=4835
The State Switcher package allows you to switch visibility and collision on an entity and all of its children (recursively). You can also use it to switch or toggle visibility for a single client, using LocalToggleVisibility or LocalSwitchVisibility.
To set up:
- Add the stateSwitcherScript to the root entity of any structure you want to change all visibility / collision on
- Hook any event or function call into the state switcher, and call ToggleVisibility (will switch to the opposite state), SwitchVisibility (you tell it whether to be visible), ToggleCollision (will switch to the opposite state), SwitchCollision (you tell it whether to be collidable)
- If you want to be able to change visibility on a client, add the LocalHandler script folder to the User template. You can then use the LocalToggleVisibility and LocalSwitchVisibility functions - for these, you must pass the player you’re changing the visibility for as the second argument
Examples uses:
- Easily “turn on / off” large structures such as buildings with one function
- Set structures visible/invisible for some clients and not others, e.g. you could have a team game with one team with “X ray vision”, where you hide solid walls for them and instead show glass walls