Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a way to wait a GUI until another GUI "function" is done?[Solved]

Asked by 4 years ago
Edited 4 years ago

So I am trying to make the mainFrame size expand after the GUI sets its position at UDim2.new(0.3,0,0.4,0).

local mainFrame = script.Parent.MainFrame
local secondaryFrame = script.Parent.FrameTwo
local textLabel = script.Parent.TextLabel
local easingDirection = Enum.EasingDirection.Out
local easingStyle = Enum.EasingStyle.Bounce

mainFrame.Position = UDim2.new(-1,0,-1,0)
secondaryFrame.Position = UDim2.new(-1,0,-1,0)
textLabel.Position = UDim2.new(-1,0,-1,0)

wait(0.1)

function newMainFrame()
    mainFrame:TweenPosition(
        UDim2.new(0.3,0,0.4,0),
        easingDirection,
        easingStyle,
        2
    )

    wait(5)
    mainFrame:TweenSize(
        UDim2.new(0.3,0,0.2,0),
        easingDirection,
        easingStyle,
        2
    )
end

newMainFrame()

Thanks for the Help!

0
You should use TweenService. It has a yield function so it can do what you're trying to do. Or, as an alternate option you can use wait(). astronit 20 — 4y
0
the wait does not work awesomemode14 68 — 4y
0
I am using tween awesomemode14 68 — 4y

Answer this question