How to convert a pallate Id to BrickColor

The tittle says it all. I’m trying to convert a index code like 194, to it’s correct brick color: “Medium stone grey”. I’ve tried using “BrickColor.palette(indexCode”), but that only has a range of 0 to 63.

And I don’t want to have a list of id’s and its corresponding BrickColor.

1 Like

I’m a bit confused, what is the end goal and why are you making brick colors from a id?
If you need a list of all the brick color id’s, you can find such on this API page.

Note that there are some gaps between id’s, such as 50-100. I don’t know why it’s like that, it’s just the way it is.
P.S. you should probably just use BrickColor.new()

1 Like

I’m making a character outfit loader, and for some reasons roblox has the color codes in numbers, instead of there actual names its:

 {                  
 ["headColorId"] = 194, -- Medium stone gray.
 ["leftArmColorId"] = 194,
 ["leftLegColorId"] = 102,
 ["rightArmColorId"] = 194,
 ["rightLegColorId"] = 102,
 ["torsoColorId"] = 141
 }
local HttpService = game:GetService('HttpService')

local userId = 852714607

local function makeRequest(link)
	local response = HttpService:GetAsync(link)
	local decodedResponse = HttpService:JSONDecode(response)
	return decodedResponse
end

local getOutFits = "https://avatar.roproxy.com/v1/users/" .. userId .. "/outfits"

local outfitsResponse = makeRequest(getOutFits)

local description = Instance.new('HumanoidDescription')

if outfitsResponse and outfitsResponse.data then
	local getRandomOutfit = outfitsResponse.data[8] --outfitsResponse.data[math.random(1, #outfitsResponse.data)]

	local getOutFitDetails = "https://avatar.roproxy.com/v1/outfits/" .. getRandomOutfit.id .. "/details"
	local detailRequest = makeRequest(getOutFitDetails)
	if detailRequest then
		print(detailRequest.bodyColors)
		--[[for i, color in pairs(detailRequest.bodyColors) do
			local colorIndex = detailRequest.bodyColors[i]
			print(BrickColor.palette(colorIndex).Name)
		end]]
	end
end

--[[
{
	["assets"] =  ▼  {
		[1] =  ▶ {...},
		[2] =  ▶ {...},
		[3] =  ▶ {...},
		[4] =  ▼  {
			["assetType"] =  ▶ {...},
			["currentVersionId"] = 11201617334,
			["id"] = 36781407,
			["name"] = "Skeleton Right Arm"
		},
		[5] =  ▶ {...},
		[6] =  ▶ {...},
		[7] =  ▶ {...},
		[8] =  ▶ {...},
		[9] =  ▶ {...}
	},
	["bodyColors"] =  ▶ {...},
	["id"] = 3992333707,
	["isEditable"] = true,
	["name"] = "Idk",
	["outfitType"] = "Avatar",
	["playerAvatarType"] = "R6",
	["scale"] =  ▶ {...}
}
]]
1 Like

Weird, BrickColor.Palette does actually have a limit, as you say.
Not sure why it exists when you can just use BrickColor.new() to get the same result.
Possibly a deprecated function when there was a more limited amount of brick colors? (Despite it not being labeled as such.)

So yeah, just use BrickColor.new(ID)

1 Like

Can’t believe that worked, Thanks so much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.