如何在 ROBLOX 中连接打印输出和脚本?

我需要让打印输出执行 wait 命令。我该怎么做?

while true do
    wait(color.Parent.Time.Value == 0)
    if not parent.BrickColor == color then
        Hide()
    end
    wait(not color.Parent.Time.Value == 0)
    Show()
    parent.BrickColor = BrickColor.Random()
end
点赞
用户2466477
用户2466477

我认为你所需要的是 repeat wait() until ...

while true do
    repeat wait() until color.Parent.Time.Value == 0
    if not parent.BrickColor == color then
        Hide()
    end
    repeat wait() until not color.Parent.Time.Value == 0
    Show()
    parent.BrickColor = BrickColor.Random()
end

在原型设计或早期开发版本中使用它是可以的,但是你应该尽量避免在生产代码中使用它,你可以在这里找到替代方案 https://devforum.roblox.com/t/avoiding-wait-and-why/244015

2020-12-09 07:56:31