How to change a character's appearance locally?

I’m attempting to make it so a player sees all other players in the game as someone else, for example everyone except them looks like my character model. The problem is I can’t find a way to change all but the player’s own character. I assume the only way to do this is to change the player’s character locally, but I’m unsure how to. Currently I’m using a StarterCharacter in the StarterPlayer which turns everyone to look like my character, but I can’t find a solution to make the player look like themselves while still appearing to others as the character model. Is there a way to do this or are there limitations against this? Thanks!

You can try to use Players:GetCharacterAppearanceAsync(userId).

https://developer.roblox.com/api-reference/function/Players/GetCharacterAppearanceAsync

3 Likes

Thanks! This is definitely useful, I’m just having trouble implementing it. Setting the new model as the player’s Character does not display any difference other than a few of the model’s hats lying on the floor on the client’s side… I’ll be experimenting with it some more tomorrow and will update if I get anywhere.

You can fire a Remote Event from server side to all clients. When you listen for the event being fired to client side, you can run a loop to get all players in the game. If the player in the iteration of the loop is not the LocalPlayer you can change their character. This way the LocalPlayer sees everyone else as whatever you want them to see, and them as themselves - on their own screen.

ChangeAppearance.OnClientEvent:Connect(function()
    for _, Player in pairs(game.Players:GetPlayers()) do
        if Player ~= game.Players.LocalPlayer then
            -- DO character appearance changing stuff
        end
    end
end)

In the above code, any changes you make (where the comment is) will be made locally for you. This means if you decide to add a hat to the Player.Character in that if statement, every currently alive player in the game except for you will have that hat.

Alternatively you can fire an RemoteEvent on CharacterAdded, and pass the Player as a parameter to the remote. When it connects locally you can change the appearance of that player’s specific character rather than running the loop for everyone.

3 Likes

You would replace everything in other characters except for their HumanoidRootPart and Humanoid (and adjust the Motor6D in the root so it points to the LowerTorso in the new rig). That’s the least intrusive method of doing this (ensures their position/animation/states still replicate properly). We did this in the Aquaman event to make the local player appear as Aquaman.

1 Like

I’m having some trouble replacing the body parts in the character without that character ending up as a pile of unanchored parts. Collision between the player and the other invisible player still works, and when the script is run on the player themselves they immediately die and respawn.

Right now I’m using this script to replace all of the parts:

function ReplaceBody(player)
	if player ~= Players.LocalPlayer then
		repeat wait() until player.Character ~= nil
		local character = player.Character
		local newcharacter = RepStorage.Sukadia
		newcharacter.LowerTorso.Root.Part0 = character.HumanoidRootPart
		newcharacter.LowerTorso.Root.Part1= character.LowerTorso
		for i, part in pairs(character:GetChildren())do
			if part.Name ~= "HumanoidRootPart" and part.Name ~= "Humanoid" then
				part:Destroy()
			end
		end
		for i, newpart in pairs(newcharacter:GetChildren()) do
			local clone = newpart:Clone()
			clone.Parent = character
		end
	end
end

for i, player in pairs(Players:GetChildren()) do
	ReplaceBody(player)
end

In the “newcharacter” I have removed the Humanoid and HumanoidRootPart so there aren’t duplicates.

I wouldn’t recommend doing this without security, and something like this could be very difficult to add security to, especially depending on when this is activated.

2 Likes

For my uses of this, it is not a vital part of gameplay, it’s just cosmetic and makes no change (other than ruin the atmosphere of the game for that exploiter) if someone were to, say, disable the script and see everyone’s normal character.