Light Changing Script

Hello I’m having trouble with me code. When ever I run the script the parts do not change to neon and just stay as smooth plastic.

-- Locals --
local Frist = {"Part1","Part11","Part111"}
local Second = {"Part2","Part22","Part222"}
local Thrid = {"Part3","Part33","Part333"}
local Fourth = {"Part4","Part44","Part444"}
-- Light Change Script --
while true do
	Second.Material = Enum.Material.SmoothPlastic
	Frist.Material = Enum.Material.Neon
	wait(2)
	Frist.Material = Enum.Material.SmoothPlastic
	Second.Material = Enum.Material.Neon
	wait(2)
	Second.Material = Enum.Material.SmoothPlastic
	Thrid.Material = Enum.Material.Neon
	wait(2)
	Thrid.Material =Enum.Material.SmoothPlastic
	Fourth.Material =Enum.Material.Neon
	wait(2)
	Fourth.Material = Enum.Material.SmoothPlastic
end
1 Like
  1. You’re attempting to assign the Material property to a table, which is not valid and won’t work. If you’re trying to change the Material property of the part names in those tables, you should iterate over the table and set each part’s Material individually.
  2. To be able to do the fix above, you’ll need to either change your tables to be direct references to those parts, or specify where those parts are located.
  3. Your script has spelling issues with some variable names, but as it doesn’t affect code runtime, it’s not important to fix it.

Ok Thanks. I’m new to this. Thank you for helping :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.