I want to make a gui that tweens in and out when the player is teleporting, but I don’t know/know how to make it so it won’t yield the script.
MM Code:
function Duckss:LoadUI(Player)
local Gui = Player.PlayerGui.MainDuck.LoadingFrame
local Info = {
UDim2.new(0, 0, 0, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
1
}
Gui:TweenPosition(Info)
end
function Duckss:RemoveUI(Player)
local Gui = Player.PlayerGui.MainDuck.LoadingFrame
local Info = {
UDim2.new(0, 0, -1, 0),
Enum.EasingDirection.In,
Enum.EasingStyle.Sine,
0.75
}
Gui:TweenPosition(Info)
end
Script:
local function onClick(Player)
if Player.Character and On then
On = false
local Character = Player.Character
local HumanoidRootPart = Character.HumanoidRootPart
Character.AAC.Client.Disabled = true
wait(0.9)
HumanoidRootPart.Position = Vector3.new(script.Parent.Parent.Dominus.Position.X, script.Parent.Parent.Dominus.Position.Y + 6, script.Parent.Parent.Dominus.Position.Z)
wait(0.9)
Character.AAC.Client.Disabled = false
On = true
end
end
script.Parent.ClickDetector.MouseClick:Connect(onClick)