(in a local script)

local plr = game.Players.LocalPlayer

plr.Character:WaitForChild("Humanoid").Died:Connect(function()
	game.ReplicatedStorage.playerDeadEvent:FireServer(plr)
end)


(in a server script in serverscriptservice)


game.ReplicatedStorage.playerDeadEvent.OnServerEvent:Connect(function(i, plr)
	local character = plr.Character
	plr.character:WaitForChild("Humanoid").Died:Connect(function()
			wait(7)
			if plr.TeamColor == BrickColor.new("Really red") then
				plr.Character:MoveTo(game.Workspace.map.redtelePart.Position)
				local sword = game.ReplicatedStorage.ClassicSword:Clone()
				sword.Parent = plr.Backpack
			end
			if plr.TeamColor == BrickColor.new("Electric blue") then
				plr.Character:MoveTo(game.Workspace.map.bluetelePart.Position)
				local sword = game.ReplicatedStorage.ClassicSword:Clone()
				sword.Parent = plr.Backpack
			end
	end)
end)

works in studio when you reset and it teleports you back to the arena, but when another client kills you in server testing it just teleports you to the lobby (where the spawn points are) and this script doesn't teleport you back

2 comments

0

Why do you fireserver on death and then have the server wait for the death again, if it had already happened?

0

Try running the Humanoid.Died function on the server instead of the client.