Help With GUI Tweening

Alright, Hello everyone so I was just learning GUI tweening, And I wanted to make something with it, so i basically just made a simple button that opens a frame, and added a tween to it.

So Basically the Tween worked Once you click the button, but Once I click the button once and then close the Frame, the tween doesnt work again.

Heres what I mean:

https://gyazo.com/c2d84df20fca4e5f9df8ab383cf5c5a7

Also Heres the Code:


local StartAll = script.Parent.Menu.ShowMenu.Appear
local MainMenu = script.Parent.Menu.MainMenu

StartAll.MouseButton1Click:Connect(function()

MainMenu:TweenPosition(	 
	UDim2.new(0, 0, 0.372, 0),
	"Out",
	"Quad",
	1,
	false
	)

end)


If this is a stupid question or has an easy solution to it, Sorry I’m not advanced with lua.

If I Chose the wrong category or did anything wrong , I’m sorry, and Please tell me What I did incorrectly.

local StartAll = script.Parent.Menu.ShowMenu.Appear
local MainMenu = script.Parent.Menu.MainMenu

StartAll.MouseButton1Click:Connect(function()
MainMenu:TweenPosition(UDim2.new(0, 0, 0.372, 0), “Out”, “Quad”, 1, true) --with true it is so that it does the function and false is so that it does not do such a function
end)

local StartAll = script.Parent.Menu.ShowMenu.Appear
local MainMenu = script.Parent.Menu.MainMenu
local open = false  -- Set this to true if your frame will start off being open
local debounce = true

StartAll.MouseButton1Click:Connect(function()

    if debounce then
        debounce = false
        if open then
            open = false
            MainMenu:TweenPosition(UDim2.new(put your values here), "Out")
        else
            open = true
            MainMenu:TweenPosition(UDim2.new(put your values here), "Out")
        end
        debounce = true
    end
end)

Let me know if you have more questions.