#my sidebar wont work :(

1 messages · Page 1 of 1 (latest)

ashen drum
#

i have buttons that appear at the sides when zExpandContract is pressed, but whenever i press the buttons the others don't go to sidebarstorage, meaning they can spam open other buttons, so i made this script to open one only and one button only. (hope my explanation wasn't goofy, I just started scripting like a week ago)

#

local button = script.Parent
local plrGui = game:GetService("Players").LocalPlayer.PlayerGui
local buttonsframe = plrGui.Sidebar.MainFrame:WaitForChild("ButtonsFrame")

local buttonStorage = plrGui.SidebarStorage
local storageChildren1 = buttonsframe:GetChildren()
local storageChildren2 = buttonStorage:GetChildren()

local a = true
button.MouseButton1Click:Connect(function()
if a == true then
a = false

    button.Visible = false
    for i, v in pairs(storageChildren1) do
        if v:IsA("Frame") then
            v.Parent = buttonStorage
        end
    end
    button.Parent.Parent.Parent = buttonsframe
    buttonsframe.zExpandContract.Visible = false
    wait(0.25)

    button.Visible = true
else
    a = true
    for i, v in pairs(storageChildren2) do
        if v:IsA("Frame") then
        v.Parent = buttonsframe
        end
    end
    buttonsframe.zExpandContract.Visible = true
    wait(0.25)

    button.Visible = true
end

end)

#

the zExpandContract button becomes visible and invisible, but it seems the for loop to move those buttons on a folder doesn't work, cuz like instead of turning the buttons invisible i thought it was better to move buttons to a folder

fluid parcel
#

Calling your buttonstorage you're only capturing it when the script starts, but you're them mvoing frames and the list doesn't update, your for loop only captures the old list.

Just get the children inside the function whenever a click occurs using buttonsframe:GetChildren() inside of the function.

ashen drum
# fluid parcel Calling your buttonstorage you're only capturing it when the script starts, but ...

like this?

local button = script.Parent
local plrGui = game:GetService("Players").LocalPlayer.PlayerGui
local buttonsframe = plrGui.Sidebar.MainFrame:WaitForChild("ButtonsFrame")

local buttonStorage = plrGui.SidebarStorage

local a = true
button.MouseButton1Click:Connect(function()
if a == true then
a = false
local storageChildren1 = buttonsframe:GetChildren()
button.Visible = false
for i, v in pairs(storageChildren1) do
if v:IsA("Frame") then
v.Parent = buttonStorage
end
end
button.Parent.Parent.Parent = buttonsframe
buttonsframe.zExpandContract.Visible = false
wait(0.25)

    button.Visible = true
else
    a = true
    local storageChildren2 = buttonStorage:GetChildren()
    for i, v in pairs(storageChildren2) do
        if v:IsA("Frame") then
        v.Parent = buttonsframe
        end
    end
    buttonsframe.zExpandContract.Visible = true
    wait(0.25)

    button.Visible = true
end

end)

#

wait lemme use

#

OH MY GOD IT WORKS

#

THANK YOU SO MUCH

#

i forgot scoping existed