My script for cash and color changing script doesn't work the way it should

local can = true
local p = script.Parent
p.Touched:Connect(function(a)
	local hum = a.Parent:FindFirstChild("Humanoid")
	if can == true then
		if hum then
			can = false
			if can == false then
				can = true
				if can == true then
					can = false
					local plr = a.Parent.Name
					local PLAYER = game.Players:FindFirstChild(plr)
					PLAYER.leaderstats.Cash.Value = PLAYER.leaderstats.Cash.Value + 1
					p.BrickColor = BrickColor.new("Dark stone grey")
					wait(1)
					p.BrickColor = BrickColor.new("CGA Brown")

					can = true
				end



			end
		end

	end
end)

There is only one problem, this line: p.BrickColor = BrickColor.new("CGA Brown") doesn’t work. Can you help? Thanks in advance

Hello! I have never seen anything like this before, the brick color seems to be an invalid color. To fix this I changed p.BrickColor = BrickColor.new("CGA Brown") to p.Color = Color3.fromRGB(170, 85, 0) (that is cga brown in rgb form). I hope this helps!

1 Like

Thank you!! It worked! This helps a lot! Have a good day:D

I wish the same for you!
(3 O chars)