Slap Battles tournament GUI

I would revert back to this script for now since it worked somewhat and give me a little bit while I recreate what you have going on in studio and see if I can’t figure it out for you.

local players = {}
local tournamenton = false

while wait(10) do
	players = {} 

	for i, player in pairs(game.Players:GetPlayers()) do
		local c = ui:Clone()
		c.Parent = player.PlayerGui

		local bonksamountwin = math.random(100, 250)
		c.OuterFrame.Prize.Text = "A bonk challenge is starting with a prize of " .. bonksamountwin .. " bonks."

		c.OuterFrame.YES.MouseButton1Click:Connect(function()
			c:Destroy()
			tournamenton = true
			players = {player}
			player.Character:MoveTo(workspace.Tournament.tp.Position)

			player.Character.Humanoid.Died:Connect(function()
				local index = table.find(players, player)
				table.remove(players, index)
			end)
			if #players >= 2 then -- Added if statment before the loop.
				while wait(1) do
					if #players == 1 then
						local winner = script.WINNER:Clone()
						winner.WINNER.Visible = true
						winner.WINNER.Text = player.Name .. " HAS WON " .. bonksamountwin .. " BONKS!"
						player.Character.Humanoid.Health = 0
						player.leaderstats.Bonks.Value += bonksamountwin
						wait(2)
						winner:Destroy()
						tournamenton = false
						break
					end
				end
			end
		end)

		c.OuterFrame.NO.MouseButton1Click:Connect(function()
			c:Destroy()
		end)

		wait(7)
		c:Destroy()
	end
end

Ok, will do. Thanks for the help btw.

I tested it and this should work

local players = {}
local tournamenton = false

local ui = game.ServerStorage:WaitForChild("Tournament")

while wait(1) do
    players = {}

    if not tournamenton then
        for i, player in pairs(game.Players:GetPlayers()) do
            local c = ui:Clone()
            c.Parent = player.PlayerGui

            local bonksamountwin = math.random(100, 250)
            c.OuterFrame.Prize.Text = "A bonk challenge is starting with a prize of " .. bonksamountwin .. " bonks."

            c.OuterFrame.YES.MouseButton1Click:Connect(function()
                c:Destroy()
                tournamenton = true
                players = {player}
                print(player)
                player.Character:MoveTo(workspace.Tournament.tp.Position)

                player.Character.Humanoid.Died:Connect(function()
                    local index = table.find(players, player)
                    table.remove(players, index)
                    tournamenton = false
                end)
            end)

            c.OuterFrame.NO.MouseButton1Click:Connect(function()
                c:Destroy()
            end)

            wait(7)
            c:Destroy()
        end
    end

    if tournamenton and #players == 1 then
        print("Tournament is over!")
        local winner = script.WINNER:Clone()
        winner.WINNER.Visible = true
        winner.WINNER.Text = players[1].Name .. " HAS WON " .. bonksamountwin .. " BONKS!"
        players[1].Character.Humanoid.Health = 0
        players[1].leaderstats.Bonks.Value = players[1].leaderstats.Bonks.Value + bonksamountwin
        wait(2)
        winner:Destroy()
        tournamenton = false
    end
end

Note that it takes a second for the game to register that there is only one player

use this website to help you make almost any script you want