--I'm trying to create a script that will allow me to recolor a lot of parts, meshes, and unions within a model. I'm very amateur at scripting and could anyone help me fix this script?
Here's my code. Chest is the name of the model.
lua
if game.Workspace.Chest.Child.BrickColor = ('Dark stone grey') then BrickColor = ('Hot pink')
Output says Workspace.Script:1: 'then' expected near '='
Would appreciate any help.
Use workspace instead of game.Workspace
Use :WaitForChild() to make sure something exists before using or changing it
For if-then statements, if you want to make sure a property equals an assigned property, you need to make sure you use two equal signs ("==" instead of "=") since otherwise you are trying to assign a property, rather than comparing them
When you need to check a BrickColor, you must use BrickColor.new() before the name of the color since BrickColor is a type of property, not a string value.
if workspace:WaitForChild("Chest"):WaitForChild("Child").BrickColor == BrickColor.new("Dark stone grey") then BrickColor = BrickColor.new("Hot pink")