So I was creating this side bar and the code below does not work. Once I click the button to open the button, the GUI opens. Once I close it, the GUI closes. BUT when try to open the GUI again, it does not work.
local Frame = script.Parent
Frame.closebutton.Activated:Connect(function()
Frame:TweenPosition(UDim2.new(0, 0, 0.2, 0))
local clone = Frame.closebutton:Clone()
clone.Name = "clonebutton"
clone.Text = "<"
clone.Parent = Frame
clone.Position = Frame.closebutton.Position
Frame.closebutton:Destroy()
end)
Frame:WaitForChild("clonebutton").Activated:Connect(function()
Frame:TweenPosition(UDim2.new(-0.146, 0, 0.2, 0))
local clone = Frame.clonebutton:Clone()
clone.Name = "closebutton"
clone.Text = ">"
clone.Parent = Frame
clone.Position = Frame.clonebutton.Position
Frame.clonebutton:Destroy()
end)