Talk:Absolute beginner's guide to scripting: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Cecibean
>Cecibean
Line 36: Line 36:


''    brick = game.Workspace.Brick '' <br/>
''    brick = game.Workspace.Brick '' <br/>
''    function onTouch(part) ''
''    function onTouch(part) '' <br/>
'' brick.Transparency = 1 ''
'' brick.Transparency = 1 '' <br/>
'' wait(1) ''
'' wait(1) '' <br/>
'' brick.Transparency = 0 ''
'' brick.Transparency = 0 '' <br/>
''    end ''
''    end '' <br/>
''    brick.Touched:connect(onTouch)''
''    brick.Touched:connect(onTouch)'' <br/>


The issue is that within the onTouch() function, the object that was passed is called 'part'.  Outside of the function, it is called 'brick'.  So the code should really look like this:
The issue is that within the onTouch() function, the object that was passed is called 'part'.  Outside of the function, it is called 'brick'.  So the code should really look like this:
Anonymous user

Navigation menu