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:
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?
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:
BoxConfiguration is parent of Workspace.
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.