How to change someone's avatar to somebody else's in the game roblox

Hello, I want to make a script where it will get 2 players in a game then choose one of there avatars to go on the other one and people guess whos the real one! How would I make this?

There’s 2 resources I’ll lead you to that’ll be useful for exactly what you’re looking for.

This first one is used to generate a Humanoid Description from a Player’s UserId.

https://developer.roblox.com/en-us/api-reference/function/Players/GetHumanoidDescriptionFromUserId

You can then use said description and Apply it to any humanoid!

https://developer.roblox.com/en-us/api-reference/function/Humanoid/ApplyDescription

If you have any questions or concerns feel free to ask!

I do not really understand as these wikis don not show any information but let me be more specific. I want it to choose a random player in the game not specific and apply to another random person. Sorry

Add the two players to a table and then choose them with math.random(), like this:

local randomPlayer = playersTable[math.random(1, #playersTable)]

This script will get the random player by index. There will be only 2 players in the table so the index will be 1 or 2 and what that code does is basically playersTable[1] or playersTable[2] depending on the chosen index.

Then apply the humanoid description to one and vice versa