Hello! Im making a boxing system, where each players fight, and only one will remain at the end of it.
Currently, when the 2 players fight, and Player1 loses, they don’t get teleported back to each of their spawnpoints for another round.
In total, there should be 3 rounds, but after one player dies, the script is just not teleporting them.
Can someone please help me? I would greatly appreciate it!
Thank you.
function round(num, player)
if num == 0 then
game.ReplicatedStorage.CountdownFight:FireClient(game.Players:FindFirstChild(Player1.Value))
game.ReplicatedStorage.CountdownFight:FireClient(game.Players:FindFirstChild(Player2.Value))
game.Players:FindFirstChild(Player1.Value).Character.Humanoid.HealthChanged:Connect(function()
if game.Players:FindFirstChild(Player1.Value).Character.Humanoid.Health <= 0 then
player1death += 1
print('player 2 won')
task.wait(3)
--tp players for another round
local Character1 = game.Players:FindFirstChild(Player1.Value).Character
local HumanoidRootPart1 = Character1:FindFirstChild("HumanoidRootPart")
local Humanoid1 = Character1:FindFirstChildWhichIsA("Humanoid")
local Character2 = game.Players:FindFirstChild(Player2.Value).Character
local HumanoidRootPart2 = Character2:FindFirstChild("HumanoidRootPart")
local Humanoid2 = Character2:FindFirstChildWhichIsA("Humanoid")
if HumanoidRootPart1 and Humanoid1 then
HumanoidRootPart1.CFrame = Spawnpoints.Player1.CFrame
roundnum += 1
elseif HumanoidRootPart2 and Humanoid2 then
HumanoidRootPart2.CFrame = Spawnpoints.Player2.CFrame
roundnum += 1
end
end
end)