Help with FireClient Error

After the first correct move they died

	while (DefendingPlayer.Backpack.Data.CurrentLives.Value > 0) do

		if Switch then
			local TempPlayer = AttackingPlayer
			AttackingPlayer = DefendingPlayer
			DefendingPlayer = TempPlayer
			Switch = false
		end

		AttackingPlayer.Backpack.Data.State.Value = "Attack"
		DefendingPlayer.Backpack.Data.State.Value = "Defend"

		repeat task.wait() until (AttackingPlayer.Backpack.Data.ChosenMove.Value ~= "") and (DefendingPlayer.Backpack.Data.ChosenMove.Value ~= "")
		local AttackerChose = AttackingPlayer.Backpack.Data.ChosenMove.Value
		local DefenderChose = DefendingPlayer.Backpack.Data.ChosenMove.Value

		print("Attacker Chose", AttackerChose)
		print("Defender Chose", DefenderChose)
		local PlayedAnimation = false
		if AttackerChose == DefenderChose then
			print("Defender Loses a life, Total:", DefendingPlayer.Backpack.Data.CurrentLives.Value)
			DefendingPlayer.Backpack.Data.CurrentLives.Value -= 1

			print(Rows)
			table.insert(Rows, DefendingPlayer.Backpack.Data.ChosenMove.Value)
			for i, v in pairs(Rows) do
				PlayedAnimation = true
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end
			if #Rows == 3 then
				DefendingPlayer.Backpack.Data.CurrentLives.Value = 0
			end
			game.ReplicatedStorage.Client.HideButton:FireClient(AttackingPlayer, "Attack", AttackerChose)
			game.ReplicatedStorage.Client.HideButton:FireClient(DefendingPlayer, "Defend", DefenderChose)
		else
			for i, v in pairs(Rows) do
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end

			Rows = {}
			Switch = true
		end
		if not PlayedAnimation then
			AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..AttackingPlayer.Backpack.Data.ChosenMove.Value]):Play()
			DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..DefendingPlayer.Backpack.Data.ChosenMove.Value]):Play()
		end

		wait(1)
		AttackingPlayer.Backpack.Data.ChosenMove.Value = ""
		DefendingPlayer.Backpack.Data.ChosenMove.Value = ""

		local Player1 = game.Players:GetPlayerFromCharacter(Corners[1].Occupant.Value)
		local Player2 = game.Players:GetPlayerFromCharacter(Corners[2].Occupant.Value)

		-- Update Player1's UI
		Player1.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player1.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value

		-- Update Player2's UI
		Player2.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player2.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value
		
		DefendingPlayer.Character.Humanoid.Health = 0
		AttackingPlayer.Character.HumanoidRootPart.Anchored = false
		AttackingPlayer.Backpack.Data.State.Value = ""
		DefendingPlayer.Backpack.Data.State.Value = ""
		AttackingPlayer.Backpack.Data.Ring.Value = nil
		DefendingPlayer.Backpack.Data.Ring.Value = nil
		Attacker.Value = nil
		Defender.Value = nil
		Billboard.TextLabel.Text = Occupants.. "/2"
		for i, v in pairs(Corners) do
			v.Occupant.Value = nil
		end
		Occupants = 0
	end
end

Like this:

while (DefendingPlayer.Backpack.Data.CurrentLives.Value > 0) do

		if Switch then
			local TempPlayer = AttackingPlayer
			AttackingPlayer = DefendingPlayer
			DefendingPlayer = TempPlayer
			Switch = false
		end

		AttackingPlayer.Backpack.Data.State.Value = "Attack"
		DefendingPlayer.Backpack.Data.State.Value = "Defend"

		repeat task.wait() until (AttackingPlayer.Backpack.Data.ChosenMove.Value ~= "") and (DefendingPlayer.Backpack.Data.ChosenMove.Value ~= "")
		local AttackerChose = AttackingPlayer.Backpack.Data.ChosenMove.Value
		local DefenderChose = DefendingPlayer.Backpack.Data.ChosenMove.Value

		print("Attacker Chose", AttackerChose)
		print("Defender Chose", DefenderChose)
		local PlayedAnimation = false
		if AttackerChose == DefenderChose then
			print("Defender Loses a life, Total:", DefendingPlayer.Backpack.Data.CurrentLives.Value)
			DefendingPlayer.Backpack.Data.CurrentLives.Value -= 1

			print(Rows)
			table.insert(Rows, DefendingPlayer.Backpack.Data.ChosenMove.Value)
			for i, v in pairs(Rows) do
				PlayedAnimation = true
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end
			if #Rows == 3 then
				DefendingPlayer.Backpack.Data.CurrentLives.Value = 0
			end
			game.ReplicatedStorage.Client.HideButton:FireClient(AttackingPlayer, "Attack", AttackerChose)
			game.ReplicatedStorage.Client.HideButton:FireClient(DefendingPlayer, "Defend", DefenderChose)
		else
			for i, v in pairs(Rows) do
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end

			Rows = {}
			Switch = true
		end
		if not PlayedAnimation then
			AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..AttackingPlayer.Backpack.Data.ChosenMove.Value]):Play()
			DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..DefendingPlayer.Backpack.Data.ChosenMove.Value]):Play()
		end

		wait(1)
		AttackingPlayer.Backpack.Data.ChosenMove.Value = ""
		DefendingPlayer.Backpack.Data.ChosenMove.Value = ""

		local Player1 = game.Players:GetPlayerFromCharacter(Corners[1].Occupant.Value)
		local Player2 = game.Players:GetPlayerFromCharacter(Corners[2].Occupant.Value)

		-- Update Player1's UI
		Player1.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player1.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value

		-- Update Player2's UI
		Player2.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player2.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value
	end

	DefendingPlayer.Character.Humanoid.Health = 0
	AttackingPlayer.Character.HumanoidRootPart.Anchored = false
	AttackingPlayer.Backpack.Data.State.Value = ""
	DefendingPlayer.Backpack.Data.State.Value = ""
	AttackingPlayer.Backpack.Data.Ring.Value = nil
	DefendingPlayer.Backpack.Data.Ring.Value = nil
	Attacker.Value = nil
	Defender.Value = nil
	Billboard.TextLabel.Text = Occupants.. "/2"
	for i, v in pairs(Corners) do
		v.Occupant.Value = nil
	end
	Occupants = 0
end

Works! Thank you so much dude you have been amazing. You just helped my game remove so many bugs. I wish you the best and if you need anything please let me know!

1 Like

Hey im not sure if you will respond, but I found a bug. When someone leave the game mid round the game sort of breaks. Like the person who stayed has to reset, then that ring never works again. Is there a possible fix to this?

I literally just got on, anyways, here it is:

-- Checks if player leaves the ring
if DefendingPlayer == nil or AttackingPlayer == nil then
	Attacker.Value = nil
	Defender.Value = nil	
		
	for i, v in pairs(Corners) do
		if v.Occupant.Value ~= nil then
			local player = game.Players:GetPlayerFromCharacter(v.Occupant.Value)

			v.Occupant.Value.HumanoidRootPart.Anchored = false
			player.Backpack.Data.State.Value = ""
			player.Backpack.Data.Ring.Value = nil		
		end

		v.Occupant.Value = nil
	end

	Occupants = 0
	Billboard.TextLabel.Text = "0/2"

	-- Completely stop the game
	return
end

You put this piece of code at the start of the while loop, here:

while (DefendingPlayer.Backpack.Data.CurrentLives.Value > 0) do
		-- Right here.
		if Switch then
			local TempPlayer = AttackingPlayer
			AttackingPlayer = DefendingPlayer
			DefendingPlayer = TempPlayer
			Switch = false
		end

		AttackingPlayer.Backpack.Data.State.Value = "Attack"
		DefendingPlayer.Backpack.Data.State.Value = "Defend"

		repeat task.wait() until (AttackingPlayer.Backpack.Data.ChosenMove.Value ~= "") and (DefendingPlayer.Backpack.Data.ChosenMove.Value ~= "")
		local AttackerChose = AttackingPlayer.Backpack.Data.ChosenMove.Value
		local DefenderChose = DefendingPlayer.Backpack.Data.ChosenMove.Value

		print("Attacker Chose", AttackerChose)
		print("Defender Chose", DefenderChose)
		local PlayedAnimation = false
		if AttackerChose == DefenderChose then
			print("Defender Loses a life, Total:", DefendingPlayer.Backpack.Data.CurrentLives.Value)
			DefendingPlayer.Backpack.Data.CurrentLives.Value -= 1

			print(Rows)
			table.insert(Rows, DefendingPlayer.Backpack.Data.ChosenMove.Value)
			for i, v in pairs(Rows) do
				PlayedAnimation = true
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end
			if #Rows == 3 then
				DefendingPlayer.Backpack.Data.CurrentLives.Value = 0
			end
			game.ReplicatedStorage.Client.HideButton:FireClient(AttackingPlayer, "Attack", AttackerChose)
			game.ReplicatedStorage.Client.HideButton:FireClient(DefendingPlayer, "Defend", DefenderChose)
		else
			for i, v in pairs(Rows) do
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end

			Rows = {}
			Switch = true
		end
		if not PlayedAnimation then
			AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..AttackingPlayer.Backpack.Data.ChosenMove.Value]):Play()
			DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..DefendingPlayer.Backpack.Data.ChosenMove.Value]):Play()
		end

		wait(1)
		AttackingPlayer.Backpack.Data.ChosenMove.Value = ""
		DefendingPlayer.Backpack.Data.ChosenMove.Value = ""

		local Player1 = game.Players:GetPlayerFromCharacter(Corners[1].Occupant.Value)
		local Player2 = game.Players:GetPlayerFromCharacter(Corners[2].Occupant.Value)

		-- Update Player1's UI
		Player1.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player1.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value

		-- Update Player2's UI
		Player2.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player2.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value
		
		DefendingPlayer.Character.Humanoid.Health = 0
		AttackingPlayer.Character.HumanoidRootPart.Anchored = false
		AttackingPlayer.Backpack.Data.State.Value = ""
		DefendingPlayer.Backpack.Data.State.Value = ""
		AttackingPlayer.Backpack.Data.Ring.Value = nil
		DefendingPlayer.Backpack.Data.Ring.Value = nil
		Attacker.Value = nil
		Defender.Value = nil
		Billboard.TextLabel.Text = Occupants.. "/2"
		for i, v in pairs(Corners) do
			v.Occupant.Value = nil
		end
		Occupants = 0
	end
end

It still seems to show it as the game is still playing after I left
image

local PP = script.Parent.Proximity.ProximityPrompt
local Billboard = script.Parent.Billboard.BillboardGui

local Rep = game:GetService("ReplicatedStorage")
local Event = Rep.Client.LeaveEvent

local MPS = game:GetService("MarketplaceService")

local Attacker = script.Parent.Attacker
local Defender = script.Parent.Defender

local Corners = {script.Parent.Corner1, script.Parent.Corner2}
local Occupants = 0


local function StartFight()

	local AttackingPlayer:Player = game.Players:GetPlayerFromCharacter(Attacker.Value)
	local DefendingPlayer:Player = game.Players:GetPlayerFromCharacter(Defender.Value)

	AttackingPlayer.Backpack.Data.CurrentLives.Value = 20
	DefendingPlayer.Backpack.Data.CurrentLives.Value = 20

	game.ReplicatedStorage.Client.ChangeIcons:FireClient(AttackingPlayer, DefendingPlayer.UserId)
	game.ReplicatedStorage.Client.ChangeIcons:FireClient(DefendingPlayer, AttackingPlayer.UserId)

	local Switch = false
	local Rows = {}
	while (DefendingPlayer.Backpack.Data.CurrentLives.Value > 0) do
		
		-- Checks if player leaves the ring
		if DefendingPlayer == nil or AttackingPlayer == nil then
			Attacker.Value = nil
			Defender.Value = nil	

			for i, v in pairs(Corners) do
				if v.Occupant.Value ~= nil then
					local player = game.Players:GetPlayerFromCharacter(v.Occupant.Value)

					v.Occupant.Value.HumanoidRootPart.Anchored = false
					player.Backpack.Data.State.Value = ""
					player.Backpack.Data.Ring.Value = nil		
				end

				v.Occupant.Value = nil
			end

			Occupants = 0
			Billboard.TextLabel.Text = "0/2"

			-- Completely stop the game
			return
		end
		
		if Switch then
			local TempPlayer = AttackingPlayer
			AttackingPlayer = DefendingPlayer
			DefendingPlayer = TempPlayer
			Switch = false
		end

		AttackingPlayer.Backpack.Data.State.Value = "Attack"
		DefendingPlayer.Backpack.Data.State.Value = "Defend"

		repeat task.wait() until (AttackingPlayer.Backpack.Data.ChosenMove.Value ~= "") and (DefendingPlayer.Backpack.Data.ChosenMove.Value ~= "")
		local AttackerChose = AttackingPlayer.Backpack.Data.ChosenMove.Value
		local DefenderChose = DefendingPlayer.Backpack.Data.ChosenMove.Value

		print("Attacker Chose", AttackerChose)
		print("Defender Chose", DefenderChose)
		local PlayedAnimation = false
		if AttackerChose == DefenderChose then
			print("Defender Loses a life, Total:", DefendingPlayer.Backpack.Data.CurrentLives.Value)
			DefendingPlayer.Backpack.Data.CurrentLives.Value -= 1

			print(Rows)
			table.insert(Rows, DefendingPlayer.Backpack.Data.ChosenMove.Value)
			for i, v in pairs(Rows) do
				PlayedAnimation = true
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end
			if #Rows == 3 then
				DefendingPlayer.Backpack.Data.CurrentLives.Value = 0
			end
			game.ReplicatedStorage.Client.HideButton:FireClient(AttackingPlayer, "Attack", AttackerChose)
			game.ReplicatedStorage.Client.HideButton:FireClient(DefendingPlayer, "Defend", DefenderChose)
		else
			for i, v in pairs(Rows) do
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end

			Rows = {}
			Switch = true
		end
		if not PlayedAnimation then
			AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..AttackingPlayer.Backpack.Data.ChosenMove.Value]):Play()
			DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..DefendingPlayer.Backpack.Data.ChosenMove.Value]):Play()
		end

		wait(1)
		AttackingPlayer.Backpack.Data.ChosenMove.Value = ""
		DefendingPlayer.Backpack.Data.ChosenMove.Value = ""

		local Player1 = game.Players:GetPlayerFromCharacter(Corners[1].Occupant.Value)
		local Player2 = game.Players:GetPlayerFromCharacter(Corners[2].Occupant.Value)

		-- Update Player1's UI
		Player1.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player1.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value

		-- Update Player2's UI
		Player2.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player2.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value
	end

	DefendingPlayer.Character.Humanoid.Health = 0
	AttackingPlayer.Character.HumanoidRootPart.Anchored = false
	AttackingPlayer.Backpack.Data.State.Value = ""
	DefendingPlayer.Backpack.Data.State.Value = ""
	AttackingPlayer.Backpack.Data.Ring.Value = nil
	DefendingPlayer.Backpack.Data.Ring.Value = nil
	Attacker.Value = nil
	Defender.Value = nil
	Billboard.TextLabel.Text = Occupants.. "/2"
	for i, v in pairs(Corners) do
		v.Occupant.Value = nil
	end
	Occupants = 0
end

PP.Triggered:Connect(function(Player)
	local Found = false
	for i, v in pairs(Corners) do
		if v.Occupant.Value == Player.Character then
			Found = true
		end
	end
	if Found then return end
	Player.PlayerGui.ShadowBoxing.LeaveMatch.Visible = true
	Occupants = Occupants + 1
	local Corner = Corners[1]

	if Corner.Occupant.Value ~= nil then
		Corner = Corners[2]
	end
	Corner.Occupant.Value = Player.Character
	Player.Backpack.Data.Ring.Value = script.Parent

	Billboard.TextLabel.Text = Occupants.. "/2"

	-- This will fire only once.
	Player.Character.Humanoid.Died:Once(function()
		-- Check if the player is still the occupant.
		if Corner.Occupant.Value == Player.Character then
			Corner.Occupant.Value = nil
			Player.PlayerGui.ShadowBoxing.LeaveMatch.Visible = false -- Hide the button when the player dies.
		end
	end)

	if Occupants == 2 then
		coroutine.wrap(function()
			wait(1)
			Billboard.Enabled = false
		end)()
		PP.Enabled = false
		local RandomNumber = math.random(1,2)
		Attacker.Value = Corners[RandomNumber].Occupant.Value
		Defender.Value = Corners[((RandomNumber == 1) and 2) or 1].Occupant.Value

		game.ReplicatedStorage.Client.Countdown:FireClient(game.Players:GetPlayerFromCharacter(Attacker.Value))
		game.ReplicatedStorage.Client.Countdown:FireClient(game.Players:GetPlayerFromCharacter(Defender.Value))
		wait(3)
		StartFight()
		PP.Enabled = true
		Billboard.Enabled = true
	end
end)

for i, v in pairs(Corners) do
	v.Occupant.Changed:Connect(function()
		if not v.Occupant.Value then
			Occupants -= 1
			Billboard.TextLabel.Text = Occupants .. "/2" -- Here
			return
		end
		local Char = v.Occupant.Value
		local Hrp:Part = Char:FindFirstChild("HumanoidRootPart")
		if not Hrp then return end
		Char.Humanoid.WalkSpeed = 0
		Hrp.AssemblyLinearVelocity = Vector3.new()
		Hrp.CFrame = v.CFrame
		Hrp.Anchored = true
		wait()
		Char.Humanoid.WalkSpeed = 16
	end)

end


Event.OnServerEvent:Connect(function(Player)
	Player.PlayerGui.ShadowBoxing.LeaveMatch.Visible = false

	for _, i in ipairs(Corners) do
		if i.Occupant.Value == Player.Character then
			i.Occupant.Value = nil
			Player.Character.HumanoidRootPart.Anchored = false
			return
		end
	end
end)

Try replacing the if Occupants == 2 if statement with this:

if Occupants == 2 then
	coroutine.wrap(function()
		wait(1)
		Billboard.Enabled = false
	end)()
	PP.Enabled = false
	local RandomNumber = math.random(1,2)
	Attacker.Value = Corners[RandomNumber].Occupant.Value
	Defender.Value = Corners[((RandomNumber == 1) and 2) or 1].Occupant.Value

	game.ReplicatedStorage.Client.Countdown:FireClient(game.Players:GetPlayerFromCharacter(Attacker.Value))
	game.ReplicatedStorage.Client.Countdown:FireClient(game.Players:GetPlayerFromCharacter(Defender.Value))
	wait(3)
	StartFight()
	wait(1)
	PP.Enabled = true
	Billboard.Enabled = true
end

This puts a small delay after the game ends.

So still the same thing happens, but I did check if the Object values were still taken and it seems that they still are. Could this mean anything?
image
image

That would mean the if statement that checks if the player leaves mid game doesn’t run.

Try replacing this line: if DefendingPlayer == nil or AttackingPlayer == nil then with

local hasPlayers = DefendingPlayer or AttackingPlayer or Defender.Value or Attacker.Value or Corners[0].Occupant.Value or Corners[1].Occupant.Value
if not hasPlayers then

This checks if a player model is missing. If it is, then the game should end.

Same thing

local PP = script.Parent.Proximity.ProximityPrompt
local Billboard = script.Parent.Billboard.BillboardGui

local Rep = game:GetService("ReplicatedStorage")
local Event = Rep.Client.LeaveEvent

local MPS = game:GetService("MarketplaceService")

local Attacker = script.Parent.Attacker
local Defender = script.Parent.Defender

local Corners = {script.Parent.Corner1, script.Parent.Corner2}
local Occupants = 0


local function StartFight()

	local AttackingPlayer:Player = game.Players:GetPlayerFromCharacter(Attacker.Value)
	local DefendingPlayer:Player = game.Players:GetPlayerFromCharacter(Defender.Value)

	AttackingPlayer.Backpack.Data.CurrentLives.Value = 20
	DefendingPlayer.Backpack.Data.CurrentLives.Value = 20

	game.ReplicatedStorage.Client.ChangeIcons:FireClient(AttackingPlayer, DefendingPlayer.UserId)
	game.ReplicatedStorage.Client.ChangeIcons:FireClient(DefendingPlayer, AttackingPlayer.UserId)

	local Switch = false
	local Rows = {}
	while (DefendingPlayer.Backpack.Data.CurrentLives.Value > 0) do
		
		-- Checks if player leaves the ring
		local hasPlayers = DefendingPlayer or AttackingPlayer or Defender.Value or Attacker.Value or Corners[0].Occupant.Value or Corners[1].Occupant.Value
		if not hasPlayers then
			Attacker.Value = nil
			Defender.Value = nil	

			for i, v in pairs(Corners) do
				if v.Occupant.Value ~= nil then
					local player = game.Players:GetPlayerFromCharacter(v.Occupant.Value)

					v.Occupant.Value.HumanoidRootPart.Anchored = false
					player.Backpack.Data.State.Value = ""
					player.Backpack.Data.Ring.Value = nil		
				end

				v.Occupant.Value = nil
			end

			Occupants = 0
			Billboard.TextLabel.Text = "0/2"

			-- Completely stop the game
			return
		end
		
		if Switch then
			local TempPlayer = AttackingPlayer
			AttackingPlayer = DefendingPlayer
			DefendingPlayer = TempPlayer
			Switch = false
		end

		AttackingPlayer.Backpack.Data.State.Value = "Attack"
		DefendingPlayer.Backpack.Data.State.Value = "Defend"

		repeat task.wait() until (AttackingPlayer.Backpack.Data.ChosenMove.Value ~= "") and (DefendingPlayer.Backpack.Data.ChosenMove.Value ~= "")
		local AttackerChose = AttackingPlayer.Backpack.Data.ChosenMove.Value
		local DefenderChose = DefendingPlayer.Backpack.Data.ChosenMove.Value

		print("Attacker Chose", AttackerChose)
		print("Defender Chose", DefenderChose)
		local PlayedAnimation = false
		if AttackerChose == DefenderChose then
			print("Defender Loses a life, Total:", DefendingPlayer.Backpack.Data.CurrentLives.Value)
			DefendingPlayer.Backpack.Data.CurrentLives.Value -= 1

			print(Rows)
			table.insert(Rows, DefendingPlayer.Backpack.Data.ChosenMove.Value)
			for i, v in pairs(Rows) do
				PlayedAnimation = true
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end
			if #Rows == 3 then
				DefendingPlayer.Backpack.Data.CurrentLives.Value = 0
			end
			game.ReplicatedStorage.Client.HideButton:FireClient(AttackingPlayer, "Attack", AttackerChose)
			game.ReplicatedStorage.Client.HideButton:FireClient(DefendingPlayer, "Defend", DefenderChose)
		else
			for i, v in pairs(Rows) do
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end

			Rows = {}
			Switch = true
		end
		if not PlayedAnimation then
			AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..AttackingPlayer.Backpack.Data.ChosenMove.Value]):Play()
			DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..DefendingPlayer.Backpack.Data.ChosenMove.Value]):Play()
		end

		wait(1)
		AttackingPlayer.Backpack.Data.ChosenMove.Value = ""
		DefendingPlayer.Backpack.Data.ChosenMove.Value = ""

		local Player1 = game.Players:GetPlayerFromCharacter(Corners[1].Occupant.Value)
		local Player2 = game.Players:GetPlayerFromCharacter(Corners[2].Occupant.Value)

		-- Update Player1's UI
		Player1.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player1.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value

		-- Update Player2's UI
		Player2.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player2.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value
	end

	DefendingPlayer.Character.Humanoid.Health = 0
	AttackingPlayer.Character.HumanoidRootPart.Anchored = false
	AttackingPlayer.Backpack.Data.State.Value = ""
	DefendingPlayer.Backpack.Data.State.Value = ""
	AttackingPlayer.Backpack.Data.Ring.Value = nil
	DefendingPlayer.Backpack.Data.Ring.Value = nil
	Attacker.Value = nil
	Defender.Value = nil
	Billboard.TextLabel.Text = Occupants.. "/2"
	for i, v in pairs(Corners) do
		v.Occupant.Value = nil
	end
	Occupants = 0
end

PP.Triggered:Connect(function(Player)
	local Found = false
	for i, v in pairs(Corners) do
		if v.Occupant.Value == Player.Character then
			Found = true
		end
	end
	if Found then return end
	Player.PlayerGui.ShadowBoxing.LeaveMatch.Visible = true
	Occupants = Occupants + 1
	local Corner = Corners[1]

	if Corner.Occupant.Value ~= nil then
		Corner = Corners[2]
	end
	Corner.Occupant.Value = Player.Character
	Player.Backpack.Data.Ring.Value = script.Parent

	Billboard.TextLabel.Text = Occupants.. "/2"

	-- This will fire only once.
	Player.Character.Humanoid.Died:Once(function()
		-- Check if the player is still the occupant.
		if Corner.Occupant.Value == Player.Character then
			Corner.Occupant.Value = nil
			Player.PlayerGui.ShadowBoxing.LeaveMatch.Visible = false -- Hide the button when the player dies.
		end
	end)

	if Occupants == 2 then
		coroutine.wrap(function()
			wait(1)
			Billboard.Enabled = false
		end)()
		PP.Enabled = false
		local RandomNumber = math.random(1,2)
		Attacker.Value = Corners[RandomNumber].Occupant.Value
		Defender.Value = Corners[((RandomNumber == 1) and 2) or 1].Occupant.Value

		game.ReplicatedStorage.Client.Countdown:FireClient(game.Players:GetPlayerFromCharacter(Attacker.Value))
		game.ReplicatedStorage.Client.Countdown:FireClient(game.Players:GetPlayerFromCharacter(Defender.Value))
		wait(3)
		StartFight()
		wait(1)
		PP.Enabled = true
		Billboard.Enabled = true
	end
end)

for i, v in pairs(Corners) do
	v.Occupant.Changed:Connect(function()
		if not v.Occupant.Value then
			Occupants -= 1
			Billboard.TextLabel.Text = Occupants .. "/2" -- Here
			return
		end
		local Char = v.Occupant.Value
		local Hrp:Part = Char:FindFirstChild("HumanoidRootPart")
		if not Hrp then return end
		Char.Humanoid.WalkSpeed = 0
		Hrp.AssemblyLinearVelocity = Vector3.new()
		Hrp.CFrame = v.CFrame
		Hrp.Anchored = true
		wait()
		Char.Humanoid.WalkSpeed = 16
	end)

end


Event.OnServerEvent:Connect(function(Player)
	Player.PlayerGui.ShadowBoxing.LeaveMatch.Visible = false

	for _, i in ipairs(Corners) do
		if i.Occupant.Value == Player.Character then
			i.Occupant.Value = nil
			Player.Character.HumanoidRootPart.Anchored = false
			return
		end
	end
end)

Ooh I see now. The game is waiting for the player to input something, so it cannot exit. Try replacing the StartFight() function with this:

local function StartFight()
	local AttackingPlayer:Player = game.Players:GetPlayerFromCharacter(Attacker.Value)
	local DefendingPlayer:Player = game.Players:GetPlayerFromCharacter(Defender.Value)

	AttackingPlayer.Backpack.Data.CurrentLives.Value = 20
	DefendingPlayer.Backpack.Data.CurrentLives.Value = 20

	game.ReplicatedStorage.Client.ChangeIcons:FireClient(AttackingPlayer, DefendingPlayer.UserId)
	game.ReplicatedStorage.Client.ChangeIcons:FireClient(DefendingPlayer, AttackingPlayer.UserId)

	local Switch = false
	local Rows = {}
	while (DefendingPlayer.Backpack.Data.CurrentLives.Value > 0) do		
		if Switch then
			local TempPlayer = AttackingPlayer
			AttackingPlayer = DefendingPlayer
			DefendingPlayer = TempPlayer
			Switch = false
		end

		AttackingPlayer.Backpack.Data.State.Value = "Attack"
		DefendingPlayer.Backpack.Data.State.Value = "Defend"

		-- Wait until both the players input something, or one leaves the game.
		repeat task.wait() until not (DefendingPlayer or AttackingPlayer or Defender.Value or Attacker.Value or Corners[0].Occupant.Value or Corners[1].Occupant.Value) or ((AttackingPlayer.Backpack.Data.ChosenMove.Value ~= "") and (DefendingPlayer.Backpack.Data.ChosenMove.Value ~= ""))

		-- Checks if player leaves the ring
		local hasPlayers = DefendingPlayer or AttackingPlayer or Defender.Value or Attacker.Value or Corners[0].Occupant.Value or Corners[1].Occupant.Value
		
		if not hasPlayers then
			Attacker.Value = nil
			Defender.Value = nil	

			for i, v in pairs(Corners) do
				if v.Occupant.Value ~= nil then
					local player = game.Players:GetPlayerFromCharacter(v.Occupant.Value)

					v.Occupant.Value.HumanoidRootPart.Anchored = false
					player.Backpack.Data.State.Value = ""
					player.Backpack.Data.Ring.Value = nil		
				end

				v.Occupant.Value = nil
			end

			Occupants = 0
			Billboard.TextLabel.Text = "0/2"

			-- Completely stop the game
			return
		end

		local AttackerChose = AttackingPlayer.Backpack.Data.ChosenMove.Value
		local DefenderChose = DefendingPlayer.Backpack.Data.ChosenMove.Value

		print("Attacker Chose", AttackerChose)
		print("Defender Chose", DefenderChose)
		local PlayedAnimation = false
		if AttackerChose == DefenderChose then
			print("Defender Loses a life, Total:", DefendingPlayer.Backpack.Data.CurrentLives.Value)
			DefendingPlayer.Backpack.Data.CurrentLives.Value -= 1

			print(Rows)
			table.insert(Rows, DefendingPlayer.Backpack.Data.ChosenMove.Value)
			for i, v in pairs(Rows) do
				PlayedAnimation = true
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end
			if #Rows == 3 then
				DefendingPlayer.Backpack.Data.CurrentLives.Value = 0
			end
			game.ReplicatedStorage.Client.HideButton:FireClient(AttackingPlayer, "Attack", AttackerChose)
			game.ReplicatedStorage.Client.HideButton:FireClient(DefendingPlayer, "Defend", DefenderChose)
		else
			for i, v in pairs(Rows) do
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end

			Rows = {}
			Switch = true
		end
		if not PlayedAnimation then
			AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..AttackingPlayer.Backpack.Data.ChosenMove.Value]):Play()
			DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..DefendingPlayer.Backpack.Data.ChosenMove.Value]):Play()
		end

		wait(1)
		AttackingPlayer.Backpack.Data.ChosenMove.Value = ""
		DefendingPlayer.Backpack.Data.ChosenMove.Value = ""

		local Player1 = game.Players:GetPlayerFromCharacter(Corners[1].Occupant.Value)
		local Player2 = game.Players:GetPlayerFromCharacter(Corners[2].Occupant.Value)

		-- Update Player1's UI
		Player1.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player1.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value

		-- Update Player2's UI
		Player2.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player2.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value
	end

	DefendingPlayer.Character.Humanoid.Health = 0
	AttackingPlayer.Character.HumanoidRootPart.Anchored = false
	AttackingPlayer.Backpack.Data.State.Value = ""
	DefendingPlayer.Backpack.Data.State.Value = ""
	AttackingPlayer.Backpack.Data.Ring.Value = nil
	DefendingPlayer.Backpack.Data.Ring.Value = nil
	Attacker.Value = nil
	Defender.Value = nil
	Billboard.TextLabel.Text = Occupants.. "/2"
	for i, v in pairs(Corners) do
		v.Occupant.Value = nil
	end
	Occupants = 0
end

Still not working lol. I am testing in Roblox studio as if player 1 leaves and I still have to test with player 2. That wont mess anything up would it?

I think I made a mistake here:

repeat task.wait() until not (DefendingPlayer or AttackingPlayer or Defender.Value or Attacker.Value or Corners[0].Occupant.Value or Corners[1].Occupant.Value) or ((AttackingPlayer.Backpack.Data.ChosenMove.Value ~= "") and (DefendingPlayer.Backpack.Data.ChosenMove.Value ~= ""))

Try this instead, with most of the or replaced with and:

repeat task.wait() until not (DefendingPlayer and AttackingPlayer and Defender.Value and Attacker.Value and Corners[0].Occupant.Value and Corners[1].Occupant.Value) or ((AttackingPlayer.Backpack.Data.ChosenMove.Value ~= "") and (DefendingPlayer.Backpack.Data.ChosenMove.Value ~= ""))

Still nothing :frowning: im not sure why

local PP = script.Parent.Proximity.ProximityPrompt
local Billboard = script.Parent.Billboard.BillboardGui

local Rep = game:GetService("ReplicatedStorage")
local Event = Rep.Client.LeaveEvent

local MPS = game:GetService("MarketplaceService")

local Attacker = script.Parent.Attacker
local Defender = script.Parent.Defender

local Corners = {script.Parent.Corner1, script.Parent.Corner2}
local Occupants = 0


local function StartFight()
	local AttackingPlayer:Player = game.Players:GetPlayerFromCharacter(Attacker.Value)
	local DefendingPlayer:Player = game.Players:GetPlayerFromCharacter(Defender.Value)

	AttackingPlayer.Backpack.Data.CurrentLives.Value = 20
	DefendingPlayer.Backpack.Data.CurrentLives.Value = 20

	game.ReplicatedStorage.Client.ChangeIcons:FireClient(AttackingPlayer, DefendingPlayer.UserId)
	game.ReplicatedStorage.Client.ChangeIcons:FireClient(DefendingPlayer, AttackingPlayer.UserId)

	local Switch = false
	local Rows = {}
	while (DefendingPlayer.Backpack.Data.CurrentLives.Value > 0) do		
		if Switch then
			local TempPlayer = AttackingPlayer
			AttackingPlayer = DefendingPlayer
			DefendingPlayer = TempPlayer
			Switch = false
		end

		AttackingPlayer.Backpack.Data.State.Value = "Attack"
		DefendingPlayer.Backpack.Data.State.Value = "Defend"

		-- Wait until both the players input something, or one leaves the game.
		repeat task.wait() until not (DefendingPlayer and AttackingPlayer and Defender.Value and Attacker.Value and Corners[0].Occupant.Value and Corners[1].Occupant.Value) or ((AttackingPlayer.Backpack.Data.ChosenMove.Value ~= "") and (DefendingPlayer.Backpack.Data.ChosenMove.Value ~= ""))

		-- Checks if player leaves the ring
		local hasPlayers = DefendingPlayer or AttackingPlayer or Defender.Value or Attacker.Value or Corners[0].Occupant.Value or Corners[1].Occupant.Value

		if not hasPlayers then
			Attacker.Value = nil
			Defender.Value = nil	

			for i, v in pairs(Corners) do
				if v.Occupant.Value ~= nil then
					local player = game.Players:GetPlayerFromCharacter(v.Occupant.Value)

					v.Occupant.Value.HumanoidRootPart.Anchored = false
					player.Backpack.Data.State.Value = ""
					player.Backpack.Data.Ring.Value = nil		
				end

				v.Occupant.Value = nil
			end

			Occupants = 0
			Billboard.TextLabel.Text = "0/2"

			-- Completely stop the game
			return
		end

		local AttackerChose = AttackingPlayer.Backpack.Data.ChosenMove.Value
		local DefenderChose = DefendingPlayer.Backpack.Data.ChosenMove.Value

		print("Attacker Chose", AttackerChose)
		print("Defender Chose", DefenderChose)
		local PlayedAnimation = false
		if AttackerChose == DefenderChose then
			print("Defender Loses a life, Total:", DefendingPlayer.Backpack.Data.CurrentLives.Value)
			DefendingPlayer.Backpack.Data.CurrentLives.Value -= 1

			print(Rows)
			table.insert(Rows, DefendingPlayer.Backpack.Data.ChosenMove.Value)
			for i, v in pairs(Rows) do
				PlayedAnimation = true
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end
			if #Rows == 3 then
				DefendingPlayer.Backpack.Data.CurrentLives.Value = 0
			end
			game.ReplicatedStorage.Client.HideButton:FireClient(AttackingPlayer, "Attack", AttackerChose)
			game.ReplicatedStorage.Client.HideButton:FireClient(DefendingPlayer, "Defend", DefenderChose)
		else
			for i, v in pairs(Rows) do
				AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..v]):Play()
				DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..v]):Play()
				wait(0.5)
			end

			Rows = {}
			Switch = true
		end
		if not PlayedAnimation then
			AttackingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Attack"..AttackingPlayer.Backpack.Data.ChosenMove.Value]):Play()
			DefendingPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animations["Defend"..DefendingPlayer.Backpack.Data.ChosenMove.Value]):Play()
		end

		wait(1)
		AttackingPlayer.Backpack.Data.ChosenMove.Value = ""
		DefendingPlayer.Backpack.Data.ChosenMove.Value = ""

		local Player1 = game.Players:GetPlayerFromCharacter(Corners[1].Occupant.Value)
		local Player2 = game.Players:GetPlayerFromCharacter(Corners[2].Occupant.Value)

		-- Update Player1's UI
		Player1.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player1.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value

		-- Update Player2's UI
		Player2.PlayerGui.ShadowBoxing.Player1.Lives.Text = Player1.Backpack.Data.CurrentLives.Value
		Player2.PlayerGui.ShadowBoxing.Player2.Lives.Text = Player2.Backpack.Data.CurrentLives.Value
	end

	DefendingPlayer.Character.Humanoid.Health = 0
	AttackingPlayer.Character.HumanoidRootPart.Anchored = false
	AttackingPlayer.Backpack.Data.State.Value = ""
	DefendingPlayer.Backpack.Data.State.Value = ""
	AttackingPlayer.Backpack.Data.Ring.Value = nil
	DefendingPlayer.Backpack.Data.Ring.Value = nil
	Attacker.Value = nil
	Defender.Value = nil
	Billboard.TextLabel.Text = Occupants.. "/2"
	for i, v in pairs(Corners) do
		v.Occupant.Value = nil
	end
	Occupants = 0
end

PP.Triggered:Connect(function(Player)
	local Found = false
	for i, v in pairs(Corners) do
		if v.Occupant.Value == Player.Character then
			Found = true
		end
	end
	if Found then return end
	Player.PlayerGui.ShadowBoxing.LeaveMatch.Visible = true
	Occupants = Occupants + 1
	local Corner = Corners[1]

	if Corner.Occupant.Value ~= nil then
		Corner = Corners[2]
	end
	Corner.Occupant.Value = Player.Character
	Player.Backpack.Data.Ring.Value = script.Parent

	Billboard.TextLabel.Text = Occupants.. "/2"

	-- This will fire only once.
	Player.Character.Humanoid.Died:Once(function()
		-- Check if the player is still the occupant.
		if Corner.Occupant.Value == Player.Character then
			Corner.Occupant.Value = nil
			Player.PlayerGui.ShadowBoxing.LeaveMatch.Visible = false -- Hide the button when the player dies.
		end
	end)

	if Occupants == 2 then
		coroutine.wrap(function()
			wait(1)
			Billboard.Enabled = false
		end)()
		PP.Enabled = false
		local RandomNumber = math.random(1,2)
		Attacker.Value = Corners[RandomNumber].Occupant.Value
		Defender.Value = Corners[((RandomNumber == 1) and 2) or 1].Occupant.Value

		game.ReplicatedStorage.Client.Countdown:FireClient(game.Players:GetPlayerFromCharacter(Attacker.Value))
		game.ReplicatedStorage.Client.Countdown:FireClient(game.Players:GetPlayerFromCharacter(Defender.Value))
		wait(3)
		StartFight()
		wait(1)
		PP.Enabled = true
		Billboard.Enabled = true
	end
end)

for i, v in pairs(Corners) do
	v.Occupant.Changed:Connect(function()
		if not v.Occupant.Value then
			Occupants -= 1
			Billboard.TextLabel.Text = Occupants .. "/2" -- Here
			return
		end
		local Char = v.Occupant.Value
		local Hrp:Part = Char:FindFirstChild("HumanoidRootPart")
		if not Hrp then return end
		Char.Humanoid.WalkSpeed = 0
		Hrp.AssemblyLinearVelocity = Vector3.new()
		Hrp.CFrame = v.CFrame
		Hrp.Anchored = true
		wait()
		Char.Humanoid.WalkSpeed = 16
	end)

end


Event.OnServerEvent:Connect(function(Player)
	Player.PlayerGui.ShadowBoxing.LeaveMatch.Visible = false

	for _, i in ipairs(Corners) do
		if i.Occupant.Value == Player.Character then
			i.Occupant.Value = nil
			Player.Character.HumanoidRootPart.Anchored = false
			return
		end
	end
end)

There’s also this line here I forgot about.

local hasPlayers = DefendingPlayer or AttackingPlayer or Defender.Value or Attacker.Value or Corners[0].Occupant.Value or Corners[1].Occupant.Value

It also needs it’s or replaced with and. Here it is:

local hasPlayers = DefendingPlayer and AttackingPlayer and Defender.Value and Attacker.Value and Corners[0].Occupant.Value and Corners[1].Occupant.Value

Still nothing, its odd. It just keeps the remaining player standing there

When you put a print(not hasPlayers), does it print true or false? You can put this anywhere.

Its giving me an error Workspace.Ring.MainRing:40: attempt to index nil with 'Occupant' - Server - MainRing:40

repeat task.wait() until not (DefendingPlayer and AttackingPlayer and Defender.Value and Attacker.Value and Corners[0].Occupant.Value and Corners[1].Occupant.Value) or ((AttackingPlayer.Backpack.Data.ChosenMove.Value ~= "") and (DefendingPlayer.Backpack.Data.ChosenMove.Value ~= ""))