Hi, I've researched everywhere so you are my last place to go. I am stuck on making a TextLabel rock from side to side. I know how to use Tweening, but I'm not sure how to script it ????. Please help. Thanks, stevecarter31/DarxMasterX
How to specially tween a TextLabel?
2 answers
Well if you don't know tweening a good place to go is the wiki or youtube. https://developer.roblox.com/en-us/api-reference/class/TweenService
So first you would want to get your variables such as TweenInfo, the part to tween and the Position to move to.
local Gui = --Gui Directory
local TweenInformation = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local Goal = {Position = UDim2.new(PosXScale, PosXOffset, PosYScale, PosYOffset)}
Now to create the tween
local TweenService = game:GetService("TweenService")
local Gui = script.Parent --Gui Directory
local TweenInformation = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local Goal = {Position = UDim2.new(PosXScale, PosXOffset, PosYScale, PosYOffset)}
TweenService:Create(Gui, TweenInformation, Goal)
Now that we have created the tween we would need to play it with the built in function that twenservice has :Play()
local TweenService = game:GetService("TweenService")
local Gui = script.Parent --Gui Directory
local TweenInformation = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local Goal = {Position = UDim2.new(PosXScale, PosXOffset, PosYScale, PosYOffset)}
TweenService:Create(Gui, TweenInformation, Goal):Play() --here
There you go for TweenService.
There is also TweenPosition for Guis which I think would be easier, but I just covered up TweenService since it's more common usage. Here's the forum link: https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenPosition
maybe this could help:
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
No, ive read it through and I havent found anything that would help me.
That should be a comment