How do I obtain the players skin color. In my game I have a custom race system, and if you’re human, I want their skin color to be the skin color they chose on roblox.
1 Like
Players:GetCharacterAppearanceInfoAsync(PLAYER_ID)
returns a table which includes the sub-table “bodyColors”
More info: Players:GetCharacterAppearanceInfoAsync
1 Like
simple enough:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local description = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)
local bodyColors = character:FindFirstChildOfClass("BodyColors") or character:WaitForChild("BodyColors")
if bodyColors then
local torso = description.TorsoColor
local head = description.HeadColor
local lArm = description.LeftArmColor
local rArm = description.RightArmColor
local lLeg = description.LeftLegColor
local rLeg = description.RightLegColor
-- put the colors
bodyColors.TorsoColor3 = torso
bodyColors.HeadColor3 = head
bodyColors.LeftLegColor3 = lLeg
bodyColors.RightLegColor3 = rLeg
bodyColors.LeftArmColor3 = lArm
bodyColors.RightArmColor3 = rArm
end
end)
end)
4 Likes
local HumDesc = Character.Humanoid:GetAppliedDescription()
local BodyParts = {
"Head",
"LeftArm",
"LeftLeg",
"RightArm",
"RightLeg",
"Torso"
}
--Conditional here behind this 'if you're a human' ya said eh
local UserChoosed = 1 -- Example UserId Of Roblox
local ChoosenUserHumDesc = game.Players:GetHumanoidDescriptionFromUserId(UserChoosed)
for i = 1, #BodyParts do
HumDesc[BodyParts[i].."Color"] = ChoosenUserHumDesc[BodyParts[i].."Color"]
end
script.Parent.Humanoid:ApplyDescription(HumDesc)