How to do a tween like this

i want to know how to make it so a gui comes in from the right fast then slow down near the middle then speed up and go off the screen to the left

i dont really know how to explain it any better

2 Likes

Would need two tweens for that. The 2nd being as it leaves. May be best to just move that without a tween. If that is totally how you wish it to be.

jezz, hold on a bit, lol. I’d like to try this, it’s our goal now. Without a tween was terrible.

-- local script in StarterGui

local gui = game.Players.LocalPlayer.PlayerGui:WaitForChild("popinGui") -- gui name
local frame = gui.Frame -- frame name

local startX = -frame.AbsoluteSize.X
local endX = (workspace.CurrentCamera.ViewportSize.X - frame.AbsoluteSize.X) / 2 -- Middle X position

local function popinGui()
	local tweenInfo1 = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
	local tweenInfo2 = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
	
--  I like this one myself	
--	local tweenInfo1 = TweenInfo.new(2, Enum.EasingStyle.Back, Enum.EasingDirection.InOut)
--	local tweenInfo2 = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In)

	local tween1 = game:GetService("TweenService"):Create(frame, tweenInfo1, {
		Position = UDim2.new(0, endX, 0.5, 0) -- set to 0.5 -- middle for Y
	})
	local tween2 = game:GetService("TweenService"):Create(frame, tweenInfo2, {
		Position = UDim2.new(0, startX, 0.5, 0) 
	})

	tween1:Play()
	tween1.Completed:Wait()
    task.wait(2)
	tween2:Play()
end

popinGui()

This assumes the GUI is set up off screen to the right and middle Y

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.