local ReplicatedStorage = game:GetService(“ReplicatedStorage”) local Players =…
- User
local ReplicatedStorage = game:GetService(“ReplicatedStorage”) local Players = game:GetService(“Players”) local localPlayer = Players.LocalPlayer local PlayerGui = localPlayer:WaitForChild(“PlayerGui”) local MainMenuGui = PlayerGui:WaitForChild(“MainMenuGui”) local MainFrame = MainMenuGui:WaitForChild(“MainFrame”) local Animation = MainFrame:WaitForChild(“Animation”)
local categories = { {name = “Male”, folder = ReplicatedStorage:WaitForChild(“Animations”):WaitForChild(“Male”), template = ReplicatedStorage:WaitForChild(“ButtonTemplates”):WaitForChild(“MaleTemplate”), list = Animation:WaitForChild(“Men_List”)}, {name = “Female”, folder = ReplicatedStorage:WaitForChild(“Animations”):WaitForChild(“Female”), template = ReplicatedStorage:WaitForChild(“ButtonTemplates”):WaitForChild(“FemaleTemplate”), list = Animation:WaitForChild(“Women_List”)}, {name = “ThreePlus”, folder = ReplicatedStorage:WaitForChild(“Animations”):WaitForChild(“ThreePlus”), template = ReplicatedStorage:WaitForChild(“ButtonTemplates”):WaitForChild(“ThreePlusTemplate”), list = Animation:WaitForChild(“Plus_List”)}, {name = “Emote”, folder = ReplicatedStorage:WaitForChild(“Animations”):WaitForChild(“Emotes”), template = ReplicatedStorage:WaitForChild(“ButtonTemplates”):WaitForChild(“EmoteTemplate”), list = Animation:WaitForChild(“Emote_List”)} }
local All_List = Animation:WaitForChild(“All_List”)
local function hideAllLists() for _, category in categories do category.list.Visible = false end All_List.Visible = false end
local function showList(list) hideAllLists() list.Visible = true end
local function setupButtons(category) for _, anim in category.folder:GetChildren() do local button = category.template:Clone() button.Name = anim.Name button.Text = anim.Name button.Parent = category.list
local allButton = button:Clone() allButton.Parent = All_List end end
for _, category in categories do setupButtons(category) end
local TitleLabel = script.Parent:WaitForChild(“TitleLabel”) local buttons = { [“+”] = {TitleLabel:WaitForChild(“+”), function() showList(Animation:WaitForChild(“Plus_List”)) end}, [“ALL”] = {TitleLabel:WaitForChild(“ALL”), function() showList(All_List) end}, [“E”] = {TitleLabel:WaitForChild(“E”), function() showList(Animation:WaitForChild(“Emote_List”)) end}, [“M”] = {TitleLabel:WaitForChild(“M”), function() showList(Animation:WaitForChild(“Men_List”)) end}, [“W”] = {TitleLabel:WaitForChild(“W”), function() showList(Animation:WaitForChild(“Women_List”)) end} }
for , buttonInfo in buttons do local button, callback = unpack(buttonInfo) button.MouseButton1Click:Connect(callback) end
if the button is clicked and its assigned list is visible, make it invisible and make the 'All_List' visible instead. tell me what to add where, don't give me the whole script again.
- Assistant
To achieve the functionality where clicking a button toggles between showing its assigned list and the
All_Listwhen the assigned list is already visible, you'll need to modify theshowListfunction and update the button connection logic.Here are the instructions and code snippets for the changes you need to make:
-
Modify the
showListfunction to toggle visibility:
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.