Exhausted allowed execution time

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I am making a round system

  2. What is the issue? Include screenshots / videos if possible!
    I keep getting an exhausted allowed execution time error.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

So, I am making a game where it’s a comedy game show with a round system. But in this repeat I DO NOT KNOW HOW TO STOP IT FROM FREEZING MY GAME! Line 22.

  while true do
	local selectedPlayer1 = nil
	local selectedPlayer2 = nil
	for i = 30, 0, -1 do
		game.ReplicatedStorage.RoundStatus.Value = "Intermission: "..tostring(i)
		wait(1)
	end
	wait(1)
	game.ReplicatedStorage.RoundStatus.Value = "The contestants are..."
	wait(5)
	local players = game.Players:GetChildren()
	selectedPlayer1 = players[math.random(1, #players)]
	selectedPlayer2 = players[math.random(1, #players)]
	if #players < 1 then
		game.ReplicatedStorage.RoundStatus.Value = "Not enough players to begin."
		wait(2)
		return
	end
	if selectedPlayer2 == selectedPlayer1 then
		selectedPlayer2 = players[math.random(1, #players)]

		repeat until selectedPlayer2 ~= selectedPlayer1

	end
	game.ReplicatedStorage.RoundStatus.Value = selectedPlayer1.." and "..selectedPlayer2
	wait(3)
end



Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

The issue is the repeat until selectedPlayer2 ~= selectedPlayer1 needs to be repeat task.wait() until selectedPlayer2 ~= selectedPlayer1. Be careful with infinite loops :wink:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.