Resetting Character's Body Colors Back to Original

Hello there! I was wondering if there was a possible way to restore a character’s default body colors. For instance, I have a script that changes a person’s body colors to a lighter blue-ish color. However, once the second function fires, it’s supposed to change them back to how they were original. Is there a way to do this? If you could help out, I would appreciate it, thanks! :smile:

You could just use Player:LoadCharacter(), or if you’re getting it from the character then use game.Players:GetPlayerFromCharacter(Character):LoadCharacter()

1 Like

This method of the Players service allows you to fetch information about what a player is wearing (on the website), including body colours:

Alternatively, if you’re not applying custom clothing, you can fetch the player’s HumanoidDescription and apply it to their Humanoid using the following methods:

3 Likes

Can this only be achieved in a server script?

No, it can also be done in a LocalScript.

I got this error, yikes. image

Yes, LoadCharacter can only be performed on the server, and is effectively the same as respawning a character (they will be returned to a spawn point).

1 Like

Hm. I didn’t know that. Maybe try a RemoteEvent.

1 Like

Instead of LoadCharacter, since it respawns the whole character, I want the Body Colors to be restored without the person having to respawn in the game.

How exactly would I use it to determine the player’s body colors and reset them?

Here’s a little LocalScript I just put together and placed inside a TextButton:

local Players = game:GetService("Players")

local function ReapplyBodyColours(Player: Player)
	-- Access the current character or wait for it to spawn in
	local Character = Player.Character or Player.CharacterAdded:Wait()
	
	-- Load the player's default appearance
	local DefaultAppearance = Players:GetCharacterAppearanceAsync(Player.UserId)
	
	-- Find their currently applied colours and default colours from the previous line
	local CurrentColours = Character:FindFirstChildWhichIsA("BodyColors")
	local DefaultColours = DefaultAppearance:FindFirstChildWhichIsA("BodyColors") or Instance.new("BodyColors")
	
	-- If the character already has colours applied, destroy them
	if CurrentColours then
		CurrentColours:Destroy()
	end
	
	-- Reapply their default colours
	DefaultColours.Parent = Character

	-- Destroy the Model created by Players:GetCharacterAppearanceAsync, as we don't need anything else inside of it
	DefaultAppearance:Destroy()
end

script.Parent.MouseButton1Click:Connect(function()
	ReapplyBodyColours(Players.LocalPlayer)
end)

Edit: Changed Player to be a parameter of the function, as that then makes it reusable across client and server (you could put it inside a ModuleScript).

4 Likes

Although this scripts works great, it still ends up respawning the player back at the spawn point and I want to prevent that from happening as well.

Are you sure you’re not still using LoadCharacter somewhere? Because I wrote and tested this in Studio before posting it, and it only changed the character’s body colours. It’s not doing anything to respawn the character whatsoever.

1 Like

Sorry this is late. I went to bed. Try setting the player’s body color as a StringValue when they join, then set it later in your script.