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

Problem with my intro loading gui?

Asked by
Relatch 550 Moderation Voter
10 years ago

The gui seems to be getting smaller, not bigger. Why is that?

script.Jeopardy:Play()
wait(2)

script.Parent.Text = "Loading"
script.Parent.Loading:TweenSize(UDim2.new(-0.05,0,0,0), "Out","Back", 1)
if script.Parent.Loading.Size == UDim2.new(1, 0, 0, 0) then
    wait(5)
    script.Parent.Text = ""
    script.Jeopardy:Stop()
    wait(0.1)
    for i=0,1,.1 do
        script.Parent.BackgroundTransparency = i
        wait(0.2)
    end
end

1 answer

Log in to vote
1
Answered by 10 years ago

Well, first off, there are a few problems with the script. One of the problems is that you set the Y Offset/Scale to 0. This means, regardless of the X, the GUI will shrink to the size of nothing.

If you wish to tween it to the scale of 1 (whole screen, X wise), then what you may want to do is take the current Tween and replace it with this:

script.Parent.Loading:TweenSize(UDim2.new(1,0,0,0), "Out","Back", 1)

However, the problem is not fixed, considering it will still shrink. Therefore, you must apply to the Y too. Perhaps, looking something like this:

script.Parent.Loading:TweenSize(UDim2.new(1,0,1,0), "Out","Back", 1);

Another issue, is it seems you are trying to see if the designated size is reached immediately after you tween it. Something you must be aware of is that Tweening does NOT yield the thread. You may want to use wait() for the time it's given to tween.

wait(1);
if script.Parent.Loading.Size == UDim2.new(1, 0, 1, 0) then

Also, I'd recommend reading into Tweening for further information.

Ad

Answer this question