我计划用roblox制作迪斯科舞厅,但遇到了无法在正确的时间更改方块颜色的问题。我使用了命令“ wait()” ,将其设置为在1秒钟后更改颜色,但是时间间隔不匹配。
我试图创建一个新世界,并编写了与下面相同的代码,并且有效
groups = game.Workspace.groups
blocks = groups:GetChildren()
while true do
wait(0.1)
for i,groups in pairs(blocks) do
if groups.Name == "block" then
groups.BrickColor = BrickColor.new("Dark blue")
end
end
wait(0.1)
for i,groups in pairs(blocks) do
if groups.Name == "block" then
groups.BrickColor = BrickColor.new("Dark green")
end
end
wait(0.1)
for i,groups in pairs(blocks) do
if groups.Name == "block" then
groups.BrickColor = BrickColor.new("Dark orange")
end