I'm referencing a video. And I'm doing pretty much everything it's telling me to do. The video is about how to make a stoplight.

--Variables
print("Hello world!")
local stoplight= script.Parent
local red= stoplight.Red
local yellow= stoplight.Yellow
local green= stoplight.Green

--The on function
local function on(part)
	part.Material= Enum.Material.Plastic
	part.SurfaceLight.Enabled= true
end

--The off function
local function off(part)
	part.Material= Enum.Material.
	part.SurfaceLight.Enabled= false <--- The line that's giving me the error
end

--Lights will turn off and on 
while true do
	
	--Green turns on
	on(green)
	off(yellow)
	off(red)
	wait(7)
	
	--Yellow turns on
	off(green)
	on(yellow)
	off(red)
	wait(3)
	
	--Red turns on
	
	off(green)
	off(yellow)
	on(red)
	wait(10)
	
end

I'm just putting an equal sign and there's an error in it. If I run it, I get this error.

12:50:20.944 - Workspace.StopLight.Light Controller:17: Expected identifier when parsing expression, got '='

Why does this happen and how do I fix this? This is literally correct. How is this even deemed incorrect?

2 comments

1

You forgot the .Plastic at Line 16

0

oof. Right, thank you for the tip.