Why won't my animation for UI work?

local TweenService = game:GetService("TweenService")
local SupportButton = script.Parent
local FrameFolder = SupportButton.Parent:WaitForChild("FrameFolder")
local SupportFrame = FrameFolder:WaitForChild("SupportFrame")

local PropertyTable = {}

SupportButton.Activated:Connect(function()
	if not SupportFrame.Visible then
		SupportFrame.Visible = true
		SupportButton.Active = false
		local Info = TweenInfo.new(.5, 
			Enum.EasingStyle.Quad,
			Enum.EasingDirection.Out
		)
		PropertyTable.Size = UDim2.new(0.6, 0, 0.6, 0)
		local Tween = TweenService:Create(SupportFrame, Info, PropertyTable)
		Tween:Play()
		local Connect
		Connect = Tween.Completed:Connect(function()
			print(SupportFrame.Size)
			SupportButton.Active = true
			Connect:Disconnect()
		end)
	end
	
	if SupportFrame.Visible then
		SupportButton.Active = false
		local NewInfo = TweenInfo.new(.5, 
			Enum.EasingStyle.Quad, 
			Enum.EasingDirection.In)
		PropertyTable.Size = UDim2.new(0, 0, 0, 0)
		local NewTween = TweenService:Create(SupportFrame, NewInfo, PropertyTable)
		NewTween:Play()
		local Connection
		Connection = NewTween.Completed:Connect(function()
			SupportFrame.Visible = false
			SupportButton.Active = true
			Connection:Disconnect()
		end)
	end
end)

When I test this in game, the UI is just a tiny little dot and its size hasn’t changed at all.

There are no errors in the output by the way,

Wait I think I found the possible mistake I will try to figure it out but someone please give me suggestions on how to fix.

Ok I think I have an idea on what the possible issue is:

The activated event runs both if statements, so after I make the frame visible the other if statement also runs if you know what I mean. So I’ll add something to change that.

Alright no one was willing to help but I found my solution by just switching the if statements around, thank you to everyone who helped!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.