of     1   

robloxguyjoe
#114358443Monday, September 30, 2013 5:07 PM GMT

So im trying to make a light with a switch. the off button iv named redoff, the on button called greenon and the block with the point light in is called block. I am hopeless at scriping, so could you give me a heads up how to fix this. This is the script: print 'Hello world!' local light = workspace.block.light local redoff = workspace.redoff local greenon = workspace.greenon function onclicked (greenon) light.enabled = false wait (1) light.enabled = true end greenon.clicked.light: enabled (onclick) function onclicked (redoff) light = enabled wait (1) light = disabled end redoff.clicked.light: disabled (onclick) extra info: the on and off buttons have click detector. the script is just in workspace. to start i set the light to disabled, because the idea is when u click green button it comes on, and when you click red it goes off. this script is probable totaly wrong. if i think of anything else, ill comment. if you need any more detailed info, just ask. Please help!
Spectrabox
#114358680Monday, September 30, 2013 5:15 PM GMT

Quite a few problems, I put notes next to them print ('Hello world!') --You forgot the parentheses, this is needed in any function. local light = Workspace.block.light local redoff = Workspace.redoff local greenon = Workspace.greenon -- All of these 'workspace' need to be capitalized function onclickedGreen (clicker) -- The thing in parentheses is the name of who clicked it, not the brick print(clicker) -- see how it prints your name when you click it? The line above dfines "Clicker" light.Enabled = false wait (1) light.Enabled = true -- Both Enableds need to be capitalized. end greenon.MouseClick:connect(onclickedGreen) -- this line was very messed up, just look what I changed it to. function onclickedRed (clicker) -- Changed name so it wouldn't be the same as the first function. light.Enabled = true wait (1) light.Enabled = false end redoff.ClickDetector.MouseClick:connect(onclickedRed) -- changed again
robloxguyjoe
#114358728Monday, September 30, 2013 5:17 PM GMT

Thank you!
sncplay42
#114358764Monday, September 30, 2013 5:18 PM GMT

> -- All of these 'workspace' need to be capitalized Just FYI I believe both "workspace" and "Workspace" are defined and work. Also it's worth asking if the names of light, redoff and greenon in the workspace are actually lowercase.
robloxguyjoe
#114358919Monday, September 30, 2013 5:23 PM GMT

Yes greenon and redoff in workspace is all lowercase.
robloxguyjoe
#114359210Monday, September 30, 2013 5:33 PM GMT

@choakid9 I copy and pasted your script lines into a script in workspace, but it didnt seem to work, the place im testing is is one of my active places script testing.
sncplay42
#114359238Monday, September 30, 2013 5:33 PM GMT

Do you know about the output window? http://wiki.roblox.com/index.php/Output
robloxguyjoe
#114359329Monday, September 30, 2013 5:36 PM GMT

Not really :P ill go check out that link :3.
robloxguyjoe
#114359430Monday, September 30, 2013 5:39 PM GMT

Oh in workspace block was Block. heres what output said: Hello world! 18:38:09.663 - block is not a valid member of Workspace 18:38:09.669 - Script 'Workspace.Script', Line 2 18:38:09.670 - stack end Ill change it to block, I need to remember this case sensitivity :P
robloxguyjoe
#114359480Monday, September 30, 2013 5:40 PM GMT

Right fixed that but now: Hello world! 18:39:48.060 - "Part.light" should be "Light" in Workspace.Script 18:39:48.062 - MouseClick is not a valid member of Part 18:39:48.063 - Script 'Workspace.Script', Line 13 18:39:48.065 - stack end Do you know how i can fix it?
sncplay42
#114360261Monday, September 30, 2013 6:04 PM GMT

"Part.light" should be "Light" Sounds pretty simple to follow to me.
robloxguyjoe
#114368560Monday, September 30, 2013 8:20 PM GMT

I meant the mouse click bit.
sncplay42
#114379311Monday, September 30, 2013 10:12 PM GMT

You have to add a ClickDetector; parts themselves can't detect mouse clicks. http://wiki.roblox.com/index.php/ClickDetector
robloxguyjoe
#114426390Tuesday, October 01, 2013 2:59 PM GMT

Im pretty sure iv done that. theres click detectors in greenon and redoff
robloxguyjoe
#114573727Thursday, October 03, 2013 3:33 PM GMT

Whoo i did it.

    of     1