BodyColors:SetColor(BrickColor or Color3)

As a Roblox developer, it is currently too hard to change all of the properties of a BodyColors object at once. If you just want to change the skin tone, meaning changing all of the limbs at once, it’d be nice if this object just had a method to do that instead of having to set all of the properties individually.

This might be kind of niche (games with character customization), but I don’t really see any down sides and it’d be pretty easy for someone at Roblox to implement, so why not?

BodyColors.HeadColor = skinTone
BodyColors.LeftArmColor = skinTone
BodyColors.RightArmColor = skinTone
BodyColors.LeftLegColor = skinTone
BodyColors.RightLegColor = skinTone
BodyColors.TorsoColor = skinTone

vs:

BodyColors:SetColor(skinTone)
10 Likes

I agree, this is extremely niche.

Adding API for the sake of adding new API is basically the definition of API bloat. Something like this should be made into a small Lua function inside your own code. For example:

local function setColor(bodyColors, skinTone)
	bodyColors.HeadColor = skinTone
	bodyColors.LeftArmColor = skinTone
	bodyColors.RightArmColor = skinTone
	bodyColors.LeftLegColor = skinTone
	bodyColors.RightLegColor = skinTone
	bodyColors.TorsoColor = skinTone
end

setColor(bodyColors, skinTone)

Here’s another fun way you could do it in a short way:

for _, enumItem in pairs(Enum.BodyPart:GetEnumItems()) do
	bodyColors[enumItem.Name .. "Color"] = skinTone
end

(I don’t recommend this because Enum.BodyPart has nothing to do with BodyColors, but ¯\_(ツ)_/¯)

5 Likes

Roblox is already full of methods that make code shorter and easier and accomplish tasks that would still be possible without them.

I don’t think that API bloat is a concern here because BodyColors is a pretty basic object already and you won’t really be running into this method anywhere unless you were specifically looking at the documentation for BodyColors- which is where I’d expect to see something like this.

I’d rather have the tools in the base API to write concise code rather than needing to use a ModuleScript full of convenience methods that I might need.

At the same time, this is the first time in ten years that I’ve ever needed something like this, but I checked the Wiki because I expected something like this to already exist. I guess I just figured an object that is specifically made for managing skin color would have skin color-related methods. :stuck_out_tongue:

6 Likes