Is the button rotation equal to 180. If there are errors send them and try putting a print after the if statement checking if the rotation is equal to 180.
Your code is very prone to memory leaks because button.Activated is constantly being connected (but not disconnected), and the initial problem lies in a logic error.
The following code should function more properly: (using only tweenservice, because I’m not familiar nor do I condone :TweenPosition)
local button = script.Parent
local gui = button.Parent
local TweenSvc = game:GetService("TweenService")
local closed = false -- switch
local close_PosInfo = TweenInfo.new(1,Enum.EasingStyle.Back,Enum.EasingDirection.In)
local close_PosGoal = {Position = UDim2.fromScale(0.5,1.085)}
local close_RotInfo = TweenInfo.new(1)
local close_RotGoal = {Rotation = 180}
local open_PosInfo = TweenInfo.new(1,Enum.EasingStyle.Back,Enum.EasingDirection.Out)
local open_PosGoal = {Position = UDim2.fromScale(0.5, 0.918)}
local open_RotInfo = TweenInfo.new(1)
local open_RotGoal = {Rotation = 0}
button.Activated:Connect(function()
if closed then
closed = false
TweenSvc:Create(gui,close_PosInfo,close_PosGoal):Play()
task.wait(1)
TweenSvc:Create(button,close_RotInfo,close_RotGoal):Play()
else
closed = true
TweenSvc:Create(gui,open_PosInfo,open_PosGoal):Play()
task.wait(1)
TweenSvc:Create(button,open_RotInfo,open_RotGoal):Play()
end
-- Can use debounce to prevent button spamming (but personally, I prefer more responsive UIs)
end)