local PlayersService = game:GetService(“Players”)
local Workspace = game:GetService(“Workspace”)local Button = Workspace.Button.Button
local Player1Spawn = Workspace.Spawn1
local Player2Spawn = Workspace.Spawn2
local SpawnLocation = Workspace.SpawnLocation
local Sword = game.ReplicatedStorage.Sword
local GameGui = game.StarterGui.GameGui
local Title = GameGui.Title
local remotePlay = game.ReplicatedStorage.PlaySoundlocal InRound = false
local cooldown = falselocal function StartRound(Player)
local Players = PlayersService:GetPlayers()
if #Players < 2 then
remotePlay:FireClient(Player)
Button.Parent.BillboardGui.TextLabel.Text = “Not enough players”
Button.Parent.BillboardGui.TextLabel.TextColor = BrickColor.new(1, 0, 0)
coroutine.wrap(function()
wait(0.5)
Button.Parent.BillboardGui.TextLabel.TextColor = BrickColor.new(0, 0, 0)
Button.Parent.BillboardGui.TextLabel.Text = “test button”
end)()
return
endlocal Player1 = Players[1]
local Player2 = Players[2]Player1.Character.HumanoidRootPart.CFrame = Player1Spawn.CFrame
Player1.Character.Highlight.OutlineColor = Color3.new(1, 0, 0)
local Player1Sword = Sword:Clone()
Player1Sword.Parent = Player1.Backpack
Player2.Character.HumanoidRootPart.CFrame = Player2Spawn.CFrame
Player2.Character.Highlight.OutlineColor = Color3.new(1, 0, 0)
local Player2Sword = Sword:Clone()
Player2Sword.Parent = Player2.Backpack
InRound = truelocal function ended()
print(“ENDED”)
Player1.Character.HumanoidRootPart.CFrame = workspace.SpawnLocation + Vector3.new(0,10,0)
Player2.Character.HumanoidRootPart.CFrame = workspace.SpawnLocation + Vector3.new(0,10,0)
Player1.Character.Highlight.OutlineColor = Color3.new(0, 0, 0)
Player2.Character.Highlight.OutlineColor = Color3.new(0, 0, 0)
Player1Sword:Destroy()
Player2Sword:Destroy()
InRound = false
endPlayer1.Character.Humanoid.Died:Connect(ended)
Player2.Character.Humanoid.Died:Connect(ended)
Player1 = nil
Player2 = nil
endButton.MouseClick:Connect(function(Player)
if InRound == false and not cooldown then
cooldown = true
StartRound(Player)
else
Button.Parent.BillboardGui.TextLabel.Text = “game already in progress”
Button.Parent.BillboardGui.TextLabel.TextColor = BrickColor.new(1,0,0)
remotePlay:FireClient(Player)
coroutine.wrap(function()
wait(0.5)
Button.Parent.BillboardGui.TextLabel.TextColor = BrickColor.new(0, 0, 0)
Button.Parent.BillboardGui.TextLabel.Text = “test button”
end)()
end
coroutine.wrap(function()
wait(0.5)
cooldown = false
end)()
end)
when a player dies its suppose to teleport them both back to spawn but it doesnt why?