Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I tween text on a SurfaceGUI?

Asked by 4 years ago
Edited 4 years ago

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()
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 Block_manvn 395 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

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

0
Mm yes. I shall rotate my Frame on the Z axis. Yes. Fifkee 2017 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

Answer this question