Hi I was making a game script, but the problem with the game script is when a player gets 5 points the game ends. Can you help me with making it a loop forever. Please?
local gameOver = false
if gameOver == false then
for a = 1,1,1 do
game.ReplicatedStorage.Cows:Clone().Parent = workspace
end
warn("running game")
while true do
wait()
for _, player in next, game.Players:GetPlayers() do
if getScore(player, "Cow Clicks") >= highScore then
gameOver = true
end
end
if gameOver == true then
game.Workspace.Cows:remove()
warn("wins")
wait(5)
gameOver = false
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("Torso") then
player.Character:MoveTo(spawns[i])
player.leaderstats["Cow Clicks"].Value = 0
gameOver = false
end
end
end
end
end

1 comment