So, I am trying to make a gui open/close with tweening, can someone explain why this is not working? It will open, but it will not close afterwards.
script.Parent.MouseButton1Click:Connect(function()
local work = false
if work == false then
work = true
script.Parent.Parent:TweenPosition(UDim2.new(0.736, 0,0.304, 0))
wait(1)
else
work = false
script.Parent.Parent:TweenPosition(UDim2.new(0.932, 0, 0.304, 0))
wait(1)
end
end)
This is a local script. Any help will be greatly appreciated.

2 comments
I'm not sure how to explain, I don't have a soltion for you but the "if" never notice that "work" changes value. So it never goes to the "else"
but it opened after the "if" statement.