local function onButtonClick(button) if Exceptions[button.Name] then…
- User
local function onButtonClick(button) if Exceptions[button.Name] then Exceptionsbutton.Name else local targetFrame = MainFrame.Parent:FindFirstChild(button.Name) if targetFrame and targetFrame:IsA("Frame") then if not targetFrame.Visible then targetFrame.Visible = true else targetFrame.Visible = false end else warn("Frame named '" .. button.Name .. "' not found.") end end end
if any of the frames named 'Animation', 'Morph', 'Settings' and 'Walkspeed' become visible, make the others in this list not visible.
- Assistant
To achieve the desired functionality, you can modify the
onButtonClickfunction to loop through the list of specific frames ('Animation', 'Morph', 'Settings', 'Walkspeed') and set their visibility accordingly. Here is an updated version of the function:local specificFrames = {"Animation", "Morph", "Settings", "Walkspeed"} local function onButtonClick(button) if Exceptions[button.Name] then Exceptions[button.Name]() else local targetFrame = MainFrame.Parent:FindFirstChild(button.Name) if targetFrame and targetFrame:IsA("Frame") then if not targetFrame.Visible then -- First, hide all specific frames for _, frameName in ipairs(specificFrames) do local frame = MainFrame.Parent:FindFirstChild(frameName) if frame and frame:IsA("Frame") then frame.Visible = false end end -- Then, make the target frame visible targetFrame.Visible = true else targetFrame.Visible = false end else warn("Frame named '" .. button.Name .. "' not found.") end end endHere's what the modification does:
- Define a list called
specificFramescontaining the names of your specific frames. - When a button is clicked, check if the
button.Namematches one in theExceptionstable. If so, execute the associated exception function. - If there is no associated exception function, locate the target frame by its name in the frame's parent container (
MainFrame.Parent). - If the target frame is found and is a
Frameobject, determine its current visibility state. - If the target frame is not visible:
- Loop through the
specificFrameslist and hide any frame that is currently visible. - Make the target frame visible.
- Loop through the
- If the target frame is already visible, simply hide it.
- If the target frame cannot be found, log a warning message.
This approach ensures that only one frame from the
specificFrameslist is visible at a time, fulfilling the requirement you mentioned. - Define a list called