Tweening TextLabel (ScreenGui)

How would I go about making this type of textLabel animation (shown below).
I want to use it on a loading screen and I’m thinking its just a tween, but I’m not so good with tweening. Any help and steering me into the right direction would be appreciated.

V ( it would loop continuing going back and forth ofc )

You could set up a TweenInfo value with its repeating option set to a massive number, so you won’t have to deal with waiting until a tween cycle ends when using normal looping.

Replace everthing from EasingDirection up with anything you want. The values that matter here are math.huge and true.

local tinfo = TweenInfo.new(
     delay,
     Enum.EasingStyle,
     Enum.EasingDirection,
     math.huge,
     true
)

After that, mess with rotation values in a tween’s goal to get what you want. Remember that you can use Tween:Stop() to stop the tweening at any point, since it goes on (virtually) forever without needing a loop.

Of course, logically, it will stop playing at some point, but given that math.huge is such a large number, you won’t ever need to worry about that part.

Wouldn’t math.huge just make it none-stop spin in a huge increment instead of just small little nudges ?

No, because in this case, its repeat value is set to math.huge, meaning it will repeat as many times as whatever math.huge signifies.

You could also have the repeat value be set as -1 for it to repeat forever.

1 Like

Can you direct me to a more in-depth tutorial on TweenInfo? The DevForum one doesnt seem to helpful…

This is all I have right now, and quite frankly. I have no clue what it means.

local textlabel = script.Parent

local tiinfo = TweenInfo.new(
	delay,
	Enum.EasingStyle,
	Enum.EasingDirection,
	math.huge,
	true
)

tiinfo:Play()

Here is a quick repro of the video you provided:

local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")

local localPlayer = Players.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")

local screenGui = Instance.new("ScreenGui")
screenGui.IgnoreGuiInset = true

local frame = Instance.new("Frame")
frame.Size = UDim2.fromScale(1, 1)
frame.BackgroundColor3 = Color3.fromRGB()
frame.Parent = screenGui

local textLabel = Instance.new("TextLabel")
textLabel.BackgroundTransparency = 1
textLabel.Position = UDim2.fromScale(0.5, 0.5)
textLabel.AnchorPoint = Vector2.one / 2
textLabel.Size = UDim2.fromScale(0.6, 0.6)
textLabel.Rotation = -10
textLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
textLabel.TextScaled = true
textLabel.Text = "TITLE"
textLabel.Parent = frame

screenGui.Parent = playerGui

local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, true, 0)
local tween = TweenService:Create(textLabel, tweenInfo, {
	Rotation = 10,
})

tween:Play()

local replayConnection = tween.Completed:Connect(function()
	tween:Play()
end)

-- if you want to stop this animation somewhere in the code use this line
-- replayConnection:Disconnect()
-- tween:Cancel()

Here is the roblox file:
TextLabelAnimation.rbxl (33.1 KB)

2 Likes

You would need to create a Tween object containing the tween info, the object you want to manipulate, and the end properties of said object.

local ts = game:GetService("TweenService")

local tiinfo = TweenInfo.new(
	delay,
	Enum.EasingStyle,
	Enum.EasingDirection,
	math.huge,
	true
)

local tw = ts:Create(
     script.Parent,
     tinfo,
     {
          Position = UDim2.new(0,0,0,0) -- example, set your own stuff in here
     }
)

tw:Play()
wait(5)
tw:Stop()

The tween will stop playing after 5 seconds.

2 Likes

I normally do tweening like :TweenPosition(UDim2.new(0, 0, 0, 0), “In”, “Out”, 2, true)

:TweenPosition(Position, EasingStyle, EasingDirection, Time, Repeat)

1 Like

Specifically you want to be tweening the “Rotation” property.

Additionally, you can use the “repeat count” and “reverses” parameters to assist you with this.