Hi I was doing a intermission countdown and when it got down to one it stayed at one and then it didn't teleport or have any more hint text that i added. Can you help? Line 17-22
flocal highScore = 10
local Found = nil
local h = Instance.new("Hint",workspace)
local lobbyspawns = workspace.LobbySpawns:GetChildren()
local gamespawns = {workspace.GameSpawn1.Position,workspace.GameSpawn2.Position,workspace.GameSpawn3.Position,workspace.GameSpawn4.Position,workspace.GameSpawn5.Position,workspace.GameSpawn6.Position}
local function getScore(user, stat)
if user and stat then
-- if no empty parameters, proceed
local stats = user:WaitForChild("leaderstats")
local score = stats:WaitForChild(stat)
if score then
return score.Value
end
end
end
local time2 = 20
for time2 = 20, 1, -1 do
wait(1)
h.Text = "Intermission".." ("..time2..")"
end
print("Intermission")
game.ReplicatedStorage.Cows:Clone().Parent = workspace
wait(20)
h.Text = "Inserting cows..."
wait(1)
h.Text = "Milking the cows..."
wait(1)
h.Text = "Drinking the milk..."
wait(1)
h.Text = "Selling milk..."
wait(1)
h.Text = "Making prophet..."
wait(1)
h.Text = "Teleporting all players..."
wait(0.5)
h.Text = "Starting game..."
local gspawn = gamespawns[math.random(1, #gamespawns)]
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("Torso") then
player.Character:MoveTo(Vector3.new(3, 1.2, 196))
end
local Time = 300
while Time > 1 do
h.Text = Time .. " seconds left in the game"
for _, Player in pairs(Game.Players:GetPlayers()) do
if Player:FindFirstChild("leaderstats") then
if Player.leaderstats["Cow Clicks"].Value >= highScore then -- the error is here, its effecting wait
Found = true
break
end
end
end
if not Found then
wait(1)
Time = Time - 1
print(Time)
else
break
end
end
print("Game running")
for _, player in next, game.Players:GetPlayers() do
if getScore(player, "Cow Clicks") >= highScore then
print("Game over")
h.Text = "Game over!"
local spawn = lobbyspawns[math.random(1, #lobbyspawns)]
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("Torso") then
player.Character:MoveTo(spawn)
workspace.Cows:remove()
player.leaderstats["Cow Clicks"].Value = 0
end
end
end
end
end
