将文本从右向左移动



我正在制作一款《Roblox》游戏,我希望TextLabel能够从右到左反复而平稳地移动。像这样:https://youtu.be/9f7xAxKtjXc

我已经尝试在打角时补间Textlabel,它会重新启动,但它不顺利。我希望TextLabel能像上面的视频一样从右向左平滑地移动。

我试过的代码:

local text = {script.Parent.TextLabel}
while wait() do
for _,v in pairs(text) 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.2, 0)
end
end
local text = {script.Parent.TextLabel}
while wait() do
for _,v in pairs(text) do
local temp = v.Position.X.Scale
if (temp + 1.22 <= -v.Size.X.Scale) then
temp = -0.016
end
v.Position = UDim2.new(temp - 0.01, 0, 0.2, 0)
end
end

将TextLabel的大小更改为{0, 3298},{0, 70},并使用此代码,它将是非常顺利的,只是稍微调整值,它的工作。

最新更新