Change Brick Colors

I’m working on a Classic: Rocket Arena like game, and I’m trying to change all the avatars to the original avatars. I’m trying to change the color of each body part to make it look like the original avatars.

The issue is that the head color stays white. I’ve made the code to change the face when the spawnpoint is touched. When I look inside the body model, I change the brick color with this:

head.Color = Color3.new(255,255,0)

So far, I’ve tried to change every single variable to make it work, but this is the closest I’ve gotten to making it work.

Here’s the rest of the code if you need it.

function getDecal()
	decals = {}
	for i,child in pairs(script.Parent:GetChildren()) do
		if child.ClassName == "Decal" then
			table.insert(decals, child)
		end
	end
	if #decals ~= 0 then
		return decals[math.random(1, #decals)]
	end
	return nil
end

function onTouch(hit)
	if hit.Parent:FindFirstChild("Humanoid") ~= nil then
		local head = hit.Parent:FindFirstChild("Head")
		if head ~= nil then
			local face = head:FindFirstChild("face")
			if face.Texture ~= getDecal().Texture then
				face.Texture = getDecal().Texture
			end
		end
	end
end

script.Parent.Touched:Connect(onTouch)

Isn’t this the color white? What color are you trying to make it?

Use Color3.fromRGB instead since Color3.new only accepts numbers form 0 to 1


head.Color = Color3.fromRGB(255,255,0)

1 Like

White has a RGB code of 255,255,255

255, 255, 0 turns into yellow. 255, 255, 255 would be white.

Characters are colored using the Body Colors instance.

character.["Body Colors"].HeadColor = BrickColor.new(Color3.fromRGB(75, 255, 14)) -- Using legacy BrickColor data type will clamp any RGB color to the original 1032 colors that roblox allowed for. 

this worked! i tried it and that worked.

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