Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I return the color of a part?

Here is a portion of my script:

			for i,v in pairs(hit.Parent:GetChildren()) do
				if v.ClassName == "Part" then
					local bc = Instance.new("StringValue")
					bc.Parent = v
					bc.Name = v.Name
					bc.Value = v.BrickColor
				end
			end

It says that it expected a string, got brickcolor. How do I get the string value of a brickcolor?

1 answer

✓ Accepted answer

Gotta use BrickColor.Name

for i,v in pairs(hit.Parent:GetChildren()) do
	if v.ClassName == "Part" then
		local bc = Instance.new("StringValue")
		bc.Parent = v
		bc.Name = v.Name
		bc.Value = v.BrickColor.Name -- Will give the name of the brickcolor in a string
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.