You’ve already seen my problem if you look at the title but I will be more clear. So I need some help with the script of a textbutton that opens one frame and closes the others if one of them is already open.
My menu Looks like this, a scrollframe at the bottom with textbuttons which each a script for opening it. The problem is that if you for example opened the teleporter frame and you click the Emotes button to open the emotesframe, you will see both of them and that’s not good.
I’ve tried many things but as you can see it was unsuccessful.
For example, you can create a Folder with all frames you want to close when the “Emotes button” gets clicked.
local UI = script.Parent
local FramesToClose = UI:WaitForChild("FramesToClose")
local EmotesButton = UI:WaitForChild("EmotesButton")
local EmotesFrame = FramesToClose:WaitForChild("EmotesFrame")
EmotesButton.MouseButton1Up:Connect(function()
for i, obj in ipairs(FramesToClose:GetChildren()) do
obj.Visible = false
end
EmotesFrame.Visible = true
end)
Take in count that if you want to edit any frame’s position you will need to take them out of the folder.