Anyone know why my GUI animation isn't playing?

  1. Why isn’t my GUI animating?

My frames are supposed to play the bounce animation while opening out after 5 seconds, but instead they just appear instead of playing the animation. I don’t get any errors but I don’t know what is happeninig.

local module = {}

local TweenService = game:GetService("TweenService")

local frames = script.Parent:WaitForChild('CoreUI')

local FrameOpenSpeed = 1
local FrameCloseSpeed = 0.5

local FrameOpenEasingStyle = Enum.EasingStyle.Bounce
local FrameOpenEasingDirection =  Enum.EasingDirection.Out

local frameClosingEasingStyle = Enum.EasingStyle.Bounce
local frameClosingEasingDirection = Enum.EasingDirection.Out


function module.CloseFrame(frameName)
	local frame = frames:FindFirstChild(frameName)
	if frame then
		local closeTween = TweenService:Create(frame, 
			TweenInfo.new(FrameCloseSpeed, frameClosingEasingStyle, frameClosingEasingDirection),
			{Size = UDim2.fromScale(0, 0)}
		)

		closeTween:Play()
		closeTween.Completed:Connect(function()
			frame.Visible = false
		end)
	end
end

function module.CloseAllFrames()
	for _, frame in pairs(frames:GetChildren()) do
		if frame:IsA("Frame") then
			coroutine.wrap(module.CloseFrame)(frame.Name)
		end
	end
end

function module.OpenFrame(frameName)
	module.CloseAllFrames()
	
	local frame = frames:FindFirstChild(frameName)
	if frame then
		frame.Size = UDim2.fromScale(0, 0)
		task.wait(FrameCloseSpeed + 0.1)
		frame.Visible = true
		
		local openTween = TweenService:Create(frame, TweenInfo.new(FrameOpenSpeed, FrameOpenEasingStyle, FrameOpenEasingDirection),
			{Size = UDim2.fromScale(1, 1)}
		)
		
		openTween:Play()
		
	end
end

return module

Ignore the side buttons

Basically if you are still confused, when the Gamepass Shop and Settings GUI appear, they are supposed to play an animation, but instead they just appear.

What its supposed to look like (skip to 15:10): How to make an animated UI frame opening and closing module! - YouTube

Any tips are welcome, thank you.

You gotta give us the local script where the module is being used.

This is the test script which is supposed to play the animation after 5 seconds.

 local frameTrigger = require(script.Parent:WaitForChild("FrameOpen"))

task.wait(5)

frameTrigger.OpenFrame("Shop")

task.wait(3)

frameTrigger.OpenFrame("Settings")

task.wait(3)

frameTrigger.CloseFrame("Settings")

Check the size property of the frame, before you tween it, by printing it, it should tell you the size there. If it is 1, 0, 1, 0, it won’t look like it will tween, since it has already reached the target size.