Hi I am trying to use an if statement to check the property of a object. I am a beginner and the following code does not work
if game.Workspace.Lamp.Material = Enum.Material.Glass do
Game.Workspace.Lamp.Material = Enum.Material.Neon
else
Game.Workspace.Lamp.Material = Enum.Material.Neon
endend
end)
In conditional statements, you use '==' instead of '=' to compare! :D So the beginning of your code would look like this:
if game.Workspace.Lamp.Material == Enum.Material.Glass then Game.Workspace.Lamp.Material = Enum.Material.Neon print("Material set.") end
(written from my head but it should work)
Pro tip: use 'Print' to print to the output window, good for testing whether certain parts of scripts are working.
Hope this helps, Merry Christmas!