How do I make all players switch bodies with eachother?

So, i’m making a game that has a boss thats supposed to switch the bodies of all players, then switch them back after a few seconds, then repeat. How can I do this?

3 Likes

Humanoid descriptions are love, humanoid descriptions are life.

9 Likes

I haven’t actually tested it, but you can change the Player.Character value to a different Character. Might be useful for the swapping.

Edit: Tested it, it’s possible. You do have to reassign the subject of the camera to the humanoid of the new character, though.

3 Likes

It works, but the other player dies for me

1 Like

Do you mean clientside or serverside?

1 Like

in the serverside, i tried swapping with my friend and his character died

1 Like

So when you took control, ‘your’ character basically died?

You can try this on the server:
local c1, c2 = p1.Character, p2.Character
p1.Character, p2.Character = c2, c1
c1.Parent, c2.Parent = workspace, workspace
You might need to copy/move/swap scripts over and fix the camera if its still locked onto the wrong person (set the CameraSubject to the new character).
I’m not sure why they walk to the origin though.

1 Like

Don’t try to swap character models. I really doubt that Player.Character was designed to be assignable.

As @incapaxx mentioned earlier, humanoid descriptions are designed to handle this type of problem

local description = Character.Humanoid:GetAppliedDescription()
Character2.Humanoid:ApplyDescription(description)
3 Likes

Why can it be assigned to, then… xd

That’s the best solution for when players play with their catalog items and their own avatar, but it wouldn’t for when you use morphs or other character models.