Roblox:如何让这个脚本正确运行?

我正在为我的游戏编写一个脚本,但是我有一个问题。我的脚本无法正确执行,只会将边缘放在地图外面!如果有人能够对这个进行调试,那就非常好了。 Scripting Helpers 链接

--服务
local TS = game:GetService("TweenService")----插值服务
local RS = game:GetService("RunService")--运行服务
local HS = game:GetService("HttpService")--网络服务

--定义
local part = script.Parent.SpawnTherm:WaitForChild("Moving")

while wait(4) do
    --定义变量和编辑表格
    local mathRandom = math.random(2.5, 4)
    local goal = Vector3.new(0.7, mathRandom, 0.05)
    local tweenInfo = TweenInfo.new(
        4,
        Enum.EasingStyle.Cubic,
        Enum.EasingDirection.Out,
        0,
        false,
        0
    )

    while wait(1) do
        part.Position = Vector3.new(part.Position.X, part.Position.Y, part.Position.X)
        wait(0.05)
    end

    local Tween = TS:Create(part, tweenInfo, {Size = goal})
    Tween:Play()
end
点赞