Teleporting a player as soon as they respawn

Imagine…

a sword fight between two players. When one dies, I want it so that when they respawn they’ll be teleported back to the arena for round two.

Unfortunately,

Roblox seems to be ignoring my commands to teleport both players to a certain point in the arena. The player that won (and therefore, didn’t die) is teleported just fine. The loser, on the other hand, respawns in the lobby, and is not teleported back to the arena.
I’ve heard of using RunService and “Stepped” to fix this but I guess I implemented it wrong.
My code is really big, but this is all you need to know:

plr1.Backpack.TempWins.Changed:Connect(function() -- plr1 is correctly defined, tempwins is the amount of points in the round that a person has obtained, its an intvalue in their backpack
    game:GetService("RunService").Stepped:Wait()
    print("Stepped")
    chr1.PrimaryPart.CFrame = game.Workspace.TeleportSpots.plr1spot.CFrame
    chr2.PrimaryPart.CFrame = game.Workspace.TeleportSpots.plr2spot.CFrame
end)

Things to note:

  • “Stepped” successfully prints in the output

Any help is appreciated, thank you.

3 Likes

Have you tried calling character:PivotTo() instead of shifting the primary part itself?

That aside, if you plan on having players respawn while a game is in progress, why not have a Spectator and Players Team, and add SpawnLocations that correspond to the Teams? (Spectator spawns are in the lobby, Player spawns are in the map)

There are several arenas and lobbies. Are you suggesting I have an individual team for every single arena? I don’t think that that is a good idea. Also, the player that won (and didn’t die) is teleported to the correct spot, but the respawned player doesnt.
P.S: Tried your solution of using PivotTo() instead, but it didnt change anything.

You need to execute that same code but on player.CharacterAdded:Connect(function(character) instead

2 Likes

There is no need to use Stepped. Just teleport after the player respawn

2 Likes

Anyone in the future coming across this topic; what simplay said is true, Stepped is not required.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.