BrickColor Problem

So, I’m trying to make a sensor that when the targeted object is selected, it changes the color. But for some reason there’s an error. How do I fix this?

Error:
image

Script:

if workspace.BoxConfiguration.Color.ColorType.Value == "Default" then
	Target.BrickColor = BrickColor.new(workspace.BoxSettings.ColorMenu.DefaultColorsMenu.BrickColor.Name)
end

Any other method of making this work would be appreciated!

Use a brickcolor value instead because you’re looking for an instance in the script
Could you send a screenshot of the objects in the explorer if you want me to help fix the script?

Wait for a bit, I think I have a method…

If it doesn’t work, I will take a screenshot of the entire catalog.

You’re trying to get the property with a workspace which has no properties with the BrickColor, I’m assuming the target is the workspace.

no. I’m using a specific part for this one. But it seems that the engine thinks its the workspace.

Can I see the full script so I can fix it for you?

I’m currently working on another method. If it does not work, I’ll send the screenshots and evidence, so you will not waste energy.

Is this a gui?

Full Script:

workspace.Sensors.Color.Touched:Connect(function(hit)

local Target = hit.Parent

if workspace.BoxConfiguration.Color.ColorType.Value == "Default" then
	Target.BrickColor = BrickColor.new(workspace.BoxConfiguration.Color.DefaultColor.Value.Color)
end

if workspace.BoxConfiguration.Color.ColorType.Value == "FromRGB" then
	Target.Color = Color3.fromRGB(workspace.BoxConfiguration.Color.FromRGB.Value)
end

end)

Evidences:
image

BoxConfiguration is parent of Workspace.

image

CoreFunctions is parent of Workspace. Every click shifts into a different script.

HOW IT WORKS:
A single part with a collection of scripts is used on this formula. One script is activated in the script collection. The player clicks the the part via ClickDetector, then the script disables but enables a new script in the collection with DefaultColor value changed with the corresponding BrickColor it changes to (BrickColor Value). This goes on until it is submitted where the part is passed through the sensor, which should change the color via BrickColor and Color, which did not work.

No. It isn’t a GUI but a geometric part in workspace with the included BrickColor.

local Target = hit.Parent

Remove the parent because the parent of the part will be workspace.

1 Like

Thank you! It is solved now!

The sensor works now.

1 Like

Haha yeah, it only just took me a few seconds to just realize the error.

nice

i am a rookie scripter but yes

1 Like