Frame Tweens Instantly And Incorrectly

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I’m Trying To Make A Loading Screen Effect

  2. What is the issue? The Top Frame Tweens Instantly After 3 seconds And The Bottom Frame Goes Up Instead Of Down Instantly

  3. What solutions have you tried so far? I Tried Looking On Forums But Couldn’t Find Anything

I Don’t Really Understand What’s The Issue, Also I Haven’t Used In A While

local Main = script.Parent
local Top = Main:WaitForChild("Top")
local Bottom = Main:WaitForChild("Bottom")

local ProgressBar = Bottom.LoadingBack.Background.Bar

ProgressBar:TweenSize(UDim2.new(1, 0, 0, 28), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 4, false)	

Top:TweenPosition(UDim2.new(0, 0, -0.5, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Exponential, 3, false)
Bottom:TweenPosition(UDim2.new(0, 0, 1, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Exponential, 3, false)

1 Like

Sounds like issues with your TweenInfo Time and direction.

I’m not really proficient at them, but your first value for your TweenInfo is the time it takes to perform.
Your EasingDirection.InOut makes it tween in both directions, not just one.

1 Like

TweenPosition acts a bit unpredictably sometimes. Might as well go the extra step and involve TweenService.

Give the below code a shot:

-- LocalScript

local TweenService = game:GetService("TweenService")
local Main = script.Parent
local Top = Main:WaitForChild("Top")
local Bottom = Main:WaitForChild("Bottom")

local ProgressBar = Bottom.LoadingBack.Background.Bar

local tween	
tween = TweenService:Create(ProgressBar, TweenInfo.new(4, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {Size = UDim2.new(1, 0, 0, 28)})
tween:Play()
tween.Completed:Wait()

TweenService:Create(Top, TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut), {Position = UDim2.new(0, 0, -0.5, 0)}):Play()
TweenService:Create(Bottom, TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut), {Position = UDim2.new(0, 0, 1, 0)}):Play()

Keep in mind that Tweens will not yield the code until they’re finished unless you yield them manually using task.wait() or with Tween.Completed:Wait().

Hope that helps.

2 Likes

Omg It Works! Thank You So Much!!!

1 Like