Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I tween text on a SurfaceGUI?

So, I've decided to create a brick with moving text on it for my game, but I can't seem to get it working correctly. Apologies for my ignorance, I'm still a beginner.

local TweenService = game:GetService("TweenService")
local Text = script.Parent.TextLabel

local Info = TweenInfo.new(
	5,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	-1,
	false,
	0
)

local End = 
{ 
Position = Vector3.new(0, -230, 0, -5)
}

local TextSlide = TweenService:Create(Text, Info, End)

wait(1)
TextSlide:Play()

1 comment

0

I never work with UI before, but I know Vector3 is only apply to 3D world, not 2D(like laptop screen). So the solution now is using UDim2 value type https://developer.roblox.com/en-us/api-reference/datatype/UDim2

2 answers

Turns out, I was using the wrong variable. Instead of Vector3 on line 15, I had to use UDim2.

1 comment

0

Mm yes. I shall rotate my Frame on the Z axis. Yes.

try this script

ocal images = {script.Parent.TextLabel} -- table of images add more if needed


while wait() do 
	for _,v in pairs(images) do
		local temp = v.Position.X.Scale
		if (temp <= -v.Size.X.Scale) then
			temp = 1.0
		end
		v.Position = UDim2.new(temp - 0.01, 0, 0.4, 0)
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.