Make models visible with text button

Hi, i have stumbled upon a problem.

Lets say i have 4 textButtons. First is called Jeff, Second is Bob, Third one is Peter, and Fourth is Breh.

They all have their own models.
Now, i want it so if i click the TextButton (let’s say Jeffs one) it will make jeffs model visible. And so on with other characters. Seems easy - but it isn’t, im no expert. I could try making models transparency set to 1 with each button, but i don’t want to die of old age before i make that :PPP

Go to the 8th post for reference video

Set the models parent to the script. After button press, set the parent back to workspace.

Example:

local button = script.Parent.Button
button.MouseButton1Click:Connect(function()
      script.Jeff.Parent = workspace
end)
1 Like

That kinda works, but the problem is - if i change from Jeff to breh, they would collide and both of them would be visible. I am trying to make it so only one (the one i clicked) is visible.

Make the others parent back to the script on press

1 Like

I tried doing that, but it will not work, because if “Jeff” is not in workspace and it will error with like “Jeffs parent isn’t workspace” or something like that, because if he is in the script, and i check if he is in workspace, it will erro.

I could try making a bool value that makes it true or false whenever Model is in workspace.

:FindFirstChild() is a check if its nil or not.

1 Like

It might be confusing what im talking about, so i will make it easier:

Reference video

Look at the changing “Animatronics” when the door closes. Im trying to make the same mechanic. That models change when clicked a button.