Script isn't deleting loading screen after designated wait time

I’ve used this script before but for some reason it isn’t deleting my loading screen after the desired wait time. I could use some help :wink:

1 Like

Is there any output at all? Are you using a local script? What is the object hierarchy (explorer)?

These answers will help answer the question more thoroughly. My best bet is there is a infinite yield or the wrong frame is tweened.

I’m using a local script and the hierarchy is this:
16%20PM
And the loading screen does show up in testing but it doesn’t go away after the avatar has loaded

1 Like

To avoid using a wait() to wait until the tween is done and then destroy the gui, you could use a callback to then delete it. As per the documentation shows, the last argument is the callback to when it finishes.

For your case here, it’d look like:

GUI.Frame:TweenPosition(UDim2.new(0,0,1,0), 'InOut', 'Sine', 0.5, false, function()
    GUI:Destroy()
end)

(The false is the boolean as to if the tween can be overriden.)

1 Like

I tried using this as you indicated but the loading screen still didn’t delete. I could hear my avatar moving but the loading screen was blocking the way

1 Like

In the screenshot you sent there’s no Frame inside, is there a Frame?

1 Like

No, I didn’t create a frame since it wouldn’t allow my image to be inserted

In the script you’re calling :TweenPosition() on a Frame which doesn’t exist.

You can either: Create this Frame and put the gui objects inside (The issue as to the image not showing could be related to the ZIndex, I’m not sure) or you could do an individual tween for the ImageLabel and the TextLabel.

2 Likes

I created a Frame and the new hierarchy looks like this:
23%20PM
I tested it out and it does work. The loading screen doesn’t disappear as smoothly but it does disappear

EDIT: I messed around with putting the ImageLabel into the Frame but that came out weird in testing

1 Like