Get BrickColor as a string

Hey everyone!

I’m writing this script so when a part is clicked, it will store its BrickColor into a StringValue. However, the output states that it expected a string and instead got the BrickColor.

How would I convert the BrickColor into a string? Thanks in advance.

Here’s my current script:

local players = game:GetService("Players")
local part = script.Parent

local rs = game.ReplicatedStorage
local colorVal = rs.ColorVal

part.Touched:Connect(function(hit)
	local plr = players:GetPlayerFromCharacter(hit.Parent)
	colorVal.Value = (part.BrickColor)
end)
1 Like

BrickColor’s have a name property, so do part.BrickColor.Name.

Also, BrickColorValue’s exist, if you wanna use that

1 Like

try colorVal.Value = part.BrickColor.Name !

1 Like

Funny enough, you can just tostring()

print(tostring(BrickColor.new("Really Red")))
4 Likes