Hi, in my game script I have a part where it checks if the time is less or equal to 0 and a value is false, if both of that is true it ends the game. But that doesn't work and there's no errors can you help? The problem starts around line 45
while true do
wait()
print("Game script loaded")
RandomCode = codes[math.random(1,#codes)]
print(RandomCode)
randomcode.Value = RandomCode
while intermissiontime > 0 do
intermissiontag()
for _, player in pairs(game.Players:GetChildren()) do
player.PlayerGui.TextGui.Timer.Text = "Intermission: "..intermissiontime
player.PlayerGui.TextGui.Info.Text = "Buy items and wait for the next game to start!"
end
wait(1)
end
intermissiontime = 5
while getreadytime > 0 do
getreadytimetag()
for _, player in pairs(game.Players:GetChildren()) do
player.PlayerGui.TextGui.Timer.Text = "Get ready! "..getreadytime
player.PlayerGui.TextGui.Info.Text = "Get ready to start the round!"
end
wait(1)
end
getreadytime = 6
for _, player in ipairs(game.Players:GetPlayers()) do
if player and player.Character then
local humanoid = player.Character:FindFirstChild("Humanoid")
if humanoid and humanoid.Health > 0 then
if player.Character and player.Character:FindFirstChild("Torso") then
table.insert(playersingame, player)
player.Character.Torso.CFrame = CFrame.new(spawns[math.random(1, #spawns)])
end
end
end
end
while true do
tag()
for _, player in pairs(game.Players:GetChildren()) do
player.PlayerGui.TextGui.Timer.Text = "Time left: "..timertag.Value
player.PlayerGui.TextGui.Info.Text = "Disable the bomb before it explodes!"
end
if timertag.Value <= 0 and isbombdisabled.Value == false then
for _, player in ipairs(playersingame) do
killplayers()
playersingame = {}
end
for _, player in pairs(game.Players:GetChildren()) do
player.PlayerGui.TextGui.Timer.Text = "You lost!"
player.PlayerGui.TextGui.Info.Text = "You let the bomb destroy the town!"
wait(3)
end
print("You lost")
isbombdisabled.Value = false
break
elseif isbombdisabled.Value == true then
for _, player in ipairs(playersingame) do
killplayers()
playersingame = {}
end
for _, player in pairs(game.Players:GetChildren()) do
player.PlayerGui.TextGui.Timer.Text = "You won!"
player.PlayerGui.TextGui.Info.Text = "You succesfully disabled the bomb! Everyone gets 15 points!"
wait(3)
end
for _, player in pairs(game.Players:GetChildren()) do
if player and player.Character then
player.PlayerGui.BombCodeGui:Destroy()
end
end
print("You won")
isbombdisabled.Value = false
game.workspace.TimerTag.Value = 151
break
end
end
end
