Simply put, i want my StarterCharacter to have the player’s default avatar colors, but it won’t work… It just appears as the default gray character (check picture below)
The script (located in ServerScriptService):
local Players = game:GetService("Players")
local function onPlayerAdded(player)
local avatarDescription = Players:GetHumanoidDescriptionFromUserId(player.UserId)
player.CharacterAdded:Connect(function(character)
for _, part in pairs(character:GetChildren()) do
if part:IsA("UnionOperation") or part:IsA("Part") then
if part.Name ~= "HumanoidRootPart" then
local colorPropertyName = part.Name .. "Color"
if avatarDescription[colorPropertyName] then
part.BrickColor = BrickColor.new(avatarDescription[colorPropertyName])
end
end
end
end
end)
end
Players.PlayerAdded:Connect(onPlayerAdded)
local Players = game:GetService("Players")
local function onPlayerAdded(player)
local avatarDescription = Players:GetHumanoidDescriptionFromUserId(player.UserId)
player.CharacterAdded:Connect(function(character)
for _, part in pairs(character:GetDescendants()) do
if part:IsA("UnionOperation") or part:IsA("Part") then
if not (
part.Name == "HumanoidRootPart" or
part.Name == "OpenEyes" or
part.Name == "ClosedEyes"
) then
local colorPropertyName = part.Name .. "Color"
if colorPropertyName ~= "HumanoidRootPartColor" then
part.BrickColor = BrickColor.new(avatarDescription[colorPropertyName])
end
end
end
end
end)
end
Players.PlayerAdded:Connect(onPlayerAdded)