My GUI TweenPosition doesn't work?

I want to make a my gui look smoother.
My script is not working and nothing is in the output.
I have searched for solutions but I didn’t find anything.
This is my game menu so when they click play, this will go up and disappear. The player can also move again.

local player = game.Players.LocalPlayer
local char = player.Character
script.Parent.Frame:TweenPosition(UDim2.new(0, 0, -1.2, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine)	
char.Head.Anchored = false
char.Humanoid.WalkSpeed = 16
char.Humanoid.PlatformStand = false
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
script.Parent:Destroy()
1 Like

May you provide a GIF which shows what’s the problem with the TweenPosition?

2 Likes

The thing just gets destroyed without the tween. I don’t have a screen recorder on my computer so I can’t make a gif.

You can check the gui location to see if tween operation completes if tween completed tou have to delete that

Also dont destroy the gui you can make it invisible

Because you didn’t wait for the tween to be completed, the function doesn’t yield when you did TweenPosition. You can use the callback function of TweenPosition.

1 Like

So do I have to wait until it finishes then destroy it or make it invisible?

Yes, because the GUI got deleted before the tween is finished.

Thanks but I already fixed it by adding wait().

This code I write will be more useful