How to change body part color in roblox

As a Roblox player, it is currently impossible to change individual body colors on mobile devices. The website avatar editor redirects users to the mobile app when accessed through a mobile device, and the app avatar editor itself has no support for changing the colors of individual body parts. Attempting to access the body part colors menu through the advanced button on a browser on desktop mode is also extremely difficult, because the category buttons on the page are unusable on mobile (even though the advanced menu itself works perfectly fine).

If Roblox is able to address this issue, it would improve my user experience because my current character (and many of my saved outfits) uses and depends on this (relatively neglected) feature. I am unable to customize my character colors on mobile without risking getting my entire body stuck in one color and default clothes.

This is an important feature because it is an accessible way to customize one’s avatar, and one which would probably be more widely used if it were given more emphasis. The current body part color picker is hidden behind a barely visible “advanced” link on the web body color page, and the feature in general is inaccessible to mobile users, which are a majority of the platform’s user base.

Giving non-converted players access to this feature (already supported on the backend) could also potentially improve their user experience by letting them change their avatars to their imagination’s desire (given that the range of available free items on the avatar shop is already low), thus working towards the company’s aim of building a comprehensive Metaverse where all users can freely express themselves.

Help and Feedback Scripting Support

So basically I wanted to make an attempt to change the character parts colors of the players who join my game by using this script:

Script local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(plrchar) for i, v in next, plrchar:GetChildren() do if v:IsA("Part") then v.Color = Color3.fromRGB(0,0,0) print("done") end end end) end)

But the problem is that the parts don’t turn into the new color that the script is giving them and the only thing that I have noticed is that it only prints 2 times and then stop like shown in the image below:

But what it’s actually supposed to do is that it should print “done” depending on the number of parts that your character has but I have no idea why it does that instead, does anyone have any solutions or does anyone know what’s the best way to change the character parts colors?

3 Likes

Try for i, v in pairs(plrchar:GetChildren()) do

If that doesn’t work look at this: //developer.roblox.com/en-us/api-reference/property/BasePart/Color

ExabyteDev:

Try for i, v in pairs(plrchar:GetChildren()) do

That is not related to this problem, my method of doing that will still work with no problems.

Ok try the link then, I think it should help

I think your problem is that most of a players body parts are mesh parts so try or v:IsA("MeshPart)

edit: It printed 16 times.

1 Like

That could be the problem…

That still doesn’t work, I’m still looking for solutions.

I thinks it because of the players character loading in too fast, I put a wait and it worked, but for only one arm…

That’s weird, it would be very nice if someone explains to us why that happens.

So in the script i deleted the body colors of the players character and it works better, but the arms:

In R16, the character is a MeshPart classname, not a “Part” only

This worked:
I changed the players body colors properties:

Here is the script(Im sure there is a more efficient way to do it):

local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(plrchar) plrchar["Body Colors"].HeadColor3 = Color3.fromRGB(0,0,0) plrchar["Body Colors"].LeftArmColor3 = Color3.fromRGB(0,0,0) plrchar["Body Colors"].RightArmColor3 = Color3.fromRGB(0,0,0) plrchar["Body Colors"].LeftLegColor3 = Color3.fromRGB(0,0,0) plrchar["Body Colors"].RightLegColor3 = Color3.fromRGB(0,0,0) plrchar["Body Colors"].TorsoColor3 = Color3.fromRGB(0,0,0) end) end)

5 Likes

It doesn’t work even if I changed the check on v to MeshPart instead of Part.

Thank you so much your solution works, I didn’t expect it to work like that.

1 Like

Change v to be either v is a Part or v is a MeshPart and wait until the player character has fully loaded into the game.

The script is attempting to change colors of the parts before the players character model has fully loaded.

OR you can do it like solution did it

1 Like

Easy way that I use:

local bodyColors = character:FindFirstChild("Body Colors") if bodyColors then bodyColors.HeadColor = color bodyColors.LeftArmColor = color bodyColors.LeftLegColor = color bodyColors.RightArmColor = color bodyColors.RightLegColor = color bodyColors.TorsoColor = color end

thank you, this was amazing and worked for my game.

This has an issue, this only changes the body color for the client, since it’s in a local script, other people won’t see this. You would have to make use of RemoteEvents in order to make this work.

Also, mouseclick is for clickdetectors, in the case of a button, you use mousebutton1click.

This should work:

Create a localscript in the button
Start by adding a localscript in your button, let’s now script it.

First of all, we want to detect if a player has pressed the button, we can do this by using a mousebutton1click event.

script.Parent.MouseButton1Click:Connect(function() end)

This event would fire when the player has clicked the button, we may also want to add a .3 second cooldown, to prevent the script from breaking.

We can do this by making a new variable called CoolDown, we will set this to false on standard. After that, we will check if the CoolDown is on false, if so, the script continue’s, if the CoolDown is on true, it doesn’t run the code.

We also have to set the CoolDown to true when the player clicked, then wait 0.3 seconds before we set it to false again.

Like this:

local coolDown = false script.Parent.MouseButton1Click:Connect(function() -- The player has clicked the button if coolDown == false then -- If the cooldown is false, run the code coolDown = true -- Set the cooldown to true wait(.3) -- Wait 0.3 seconds coolDown = false -- Set the coolDown to false again end end)

Great! The last thing to do is to fire the remote event to the server, so we can change the player’s color, we’re firing an event to the server, because if we change the players color on the client, only the client will see the color change, and not the other players.

So, go to ReplicatedStorage and add a RemoteEvent, call this event “BodyColorEvent”

Now, in our code we will paste the following:

game.ReplicatedStorage.BodyColorEvent:FireServer()

We’re done on the client side! Now we can script on the server side. First of all, add a script into ServerScriptService, you may call this whatever you want.

Now, we will detect when the event has been fired, type this code into your script.

game.ReplicatedStorage.BodyColorEvent.OnServerEvent:Connect(function() end)

This code will get connected once the BodyColorEvent has been fired from the local script.

Now, we will get the player and the player’s character.

game.ReplicatedStorage.BodyColorEvent.OnServerEvent:Connect(function(player) -- The argument "player" is the player that got the event, so the player who fired the event from the local script local character = player.Character -- The player's character if character then -- If the player isn't death and the character has been loaded in end end)

With this, we first of all get the player by the first argument, then we can get the player’s character by that along with checking if the character is actually there.

Now, we can finally change the player’s color.

character["LowerTorso"].BrickColor = BrickColor.new("Really blue")
character["UpperTorso"].BrickColor = BrickColor.new("Really blue")

Assuming your game type is R15 and you would like to change the torso’s color, you have to change the lower and upper torso’s color, when you use R6, you can just say “Torso”.

If you would like to change the color, change the brickcolor to a different brickcolor, if you would like to give a different body part a different color, change the bodypart where I for now placed LowerTorso and UpperTorso.

If you followed all of these steps, this should be your final code:

LocalScript

local coolDown = false script.Parent.MouseButton1Click:Connect(function() -- The player has clicked the button if coolDown == false then -- If the cooldown is false, run the code coolDown = true -- Set the cooldown to true game.ReplicatedStorage.BodyColorEvent:FireServer() wait(.3) -- Wait 0.3 seconds coolDown = false -- Set the coolDown to false again end end)

ServerScript

game.ReplicatedStorage.BodyColorEvent.OnServerEvent:Connect(function(player) -- The argument "player" is the player that got the event, so the player who fired the event from the local script local character = player.Character -- The player's character if character then -- If the player isn't death and the character has been loaded in character["LowerTorso"].BrickColor = BrickColor.new("Really blue") character["UpperTorso"].BrickColor = BrickColor.new("Really blue") end end)

Note: I didn’t test this yet, since I’m on a laptop without studio on it, if you have any errors, feel free to let me know so I can help you with it.

I hope this helped you!

Última postagem

Tag