Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm setting a function that turns off a light and I get an error. Why?

Asked by 5 years ago

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.

01--Variables
02print("Hello world!")
03local stoplight= script.Parent
04local red= stoplight.Red
05local yellow= stoplight.Yellow
06local green= stoplight.Green
07 
08--The on function
09local function on(part)
10    part.Material= Enum.Material.Plastic
11    part.SurfaceLight.Enabled= true
12end
13 
14--The off function
15local function off(part)
View all 42 lines...

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?

1
You forgot the .Plastic at Line 16 Pap3rLP 6 — 5y
0
oof. Right, thank you for the tip. Cyroxite 46 — 5y

Answer this question