Help with FireClient Error

Maybe it’s because you are trying to play animations that are already playing. So you can add this part at the start of the while (DefendingPlayer.Backpack.Data.CurrentLives.Value > 0) do loop:

for _, anim in AttackingPlayer.Character.Humanoid.Animator:GetPlayingAnimationTracks() do
	if anim.Animation.Parent == game.ReplicatedStorage.Animations then
		anim:Stop()
	end
end

for _, anim in DefendingPlayer.Character.Humanoid.Animator:GetPlayingAnimationTracks() do
	if anim.Animation.Parent == game.ReplicatedStorage.Animations then
		anim:Stop()
	end
end

This will stop all current attack/defend animations.

It still just places once if the attacker got it wrong

Then try adding this part:

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.4)
end

To here:

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.4)
	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
	-- Right here
	Rows = {}
	Switch = true
end

Okay, do I keep the changes you told me to do before?

This change as you said before?

If that part doesn’t work, you can delete it.

So it plays the first animation, but doesnt play the wrong one. So almost https://gyazo.com/04588e0f3e2dcc8e631c555ebbcbeaf8

Try removing the PlayedAnimation = true in the code you just added. That’s probably preventing the script from playing the animations.

Works perfectly! One last thing I promise before I go. How could I display the amount of lives they have to a text label?

image
image
image

There are other client scripts if the mainring doesnt seem right i can send

At the very end of the while (DefendingPlayer.Backpack.Data.CurrentLives.Value > 0) do loop, you can add these:

local Player1 = Corners[1].Occupant.Value
local Player2 = 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

It doesnt update when you lose a life

Try replacing Player1 with Defender and Player2 with Attacker, like this:

local Player1 = Corners[1].Occupant.Value
local Player2 = Corners[2].Occupant.Value

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

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

Still nothing

Here is where I placed the script

	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 = ""
	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
	
	local Player1 = Corners[1].Occupant.Value
	local Player2 = Corners[2].Occupant.Value

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

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

It has to be at the end of the while loop, 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 = Corners[1].Occupant.Value
	local Player2 = Corners[2].Occupant.Value

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

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

I got this error saying its not a valid memeber

From the code you sent me, the player value is actually AttackingPlayer and DefendingPlayer.
So It should be like this:

local Player1 = Corners[1].Occupant.Value
local Player2 = Corners[2].Occupant.Value

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

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

Fixed the issue, but gave me a different error

The code is trying to get the player’s Backpack from it’s character model. So try this:

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

Works, however when I get 3 piece comboed and it goes to 0, I dont die

Apparently, the code after the while loop also disappeared. The code that should be after the while loop is here:

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