这一直是我游戏中的一个主要问题。我一直在尝试制作一个脚本来检测值何时为 1、2、3、4 或 5。但是,即使值为 0,if 语句仍会执行,从而使计时器在任何人进入之前启动电梯。这真的很烦人,我无法修复它。这是脚本:
local players = workspace.TestMode.Players
players.Value = 0
wait(5)
script.Parent.Text = "Waiting for players..."
function StartTimer()
while true do
if players.Value == 1 or 2 or 3 or 4 or 5 then
script.Parent.Text = "15"
print("enough players")
wait(0.1)
else
script.Parent.Text = "Waiting for players..."
print("not enough players")
end
if players.Value == 1 or 2 or 3 or 4 or 5 then
wait(0.9)
script.Parent.Text = "14"
else
script.Parent.Text = "Waiting for players..."
end
wait(0.1)
if players.Value …Run Code Online (Sandbox Code Playgroud)