0

我目前正在为我的游戏编写脚本,但我有一个问题。我的脚本无法正确执行,只是将边缘放在地图之外!如果有人可以调试这将是非常好的。 脚本助手链接

--Services
local TS = game:GetService("TweenService")
local RS = game:GetService("RunService")
local HS = game:GetService("HttpService")

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


while wait(4) do
    --Defining Tables and Table Editing
    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
4

1 回答 1

0

那么有几个错误,例如你必须使用目标作为一个对象而不是一个向量,这个向量应该是goal.Position,当调用它的时候它必须只是goal no {Size = goal},你也没有'如果每次都相同,则不需要每次都创建所有这些信息,我没有得到您想要实现的目标,但是我知道您想将其向上移动,因此它将是这样的:

local TS = game:GetService("TweenService")
local RS = game:GetService("RunService")
local HS = game:GetService("HttpService")

local part = script.Parent.SpawnTherm:WaitForChild("Moving")
local start = {}
start.Position = script.Parent.Position --where you want the part to start moving
local goal = {}
local tweenInfo = TweenInfo.new(
    4,
    Enum.EasingStyle.Cubic,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)

while wait(4) do
    script.Parent.Position = start.Position
    local mathRandom = math.random(2.5, 4) --your value, I used 15 to test it
    goal.Position = Vector3.new(0.7, mathRandom, 0.05)
    local Tween = TS:Create(part, tweenInfo, goal)
    Tween:Play()
end

我让它在这里工作: https ://www.roblox.com/games/5842432488/Help-for-reidlab

您可以编辑地点

于 2020-10-18T01:39:29.163 回答