- 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.