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

From Legacy Roblox Wiki
Jump to navigationJump to search
>Cecibean
No edit summary
>Cecibean
Line 35: Line 35:
In the 'Complete the script' lesson, the code as it currently stands:
In the 'Complete the script' lesson, the code as it currently stands:


     brick = game.Workspace.Brick --tagging the brick
     brick = game.Workspace.Brick  
     function onTouch(part) --the function
     function onTouch(part)  
brick.Transparency = 1 --what the function is to do with the brick
brick.Transparency = 1  
wait(1)  
wait(1)  
brick.Transparency = 0  
brick.Transparency = 0  
     end  
     end  
     brick.Touched:connect(onTouch) --listening event
     brick.Touched:connect(onTouch)


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:


     brick = game.Workspace.Brick --tagging the brick
     brick = game.Workspace.Brick
     function onTouch(part) --the function
     function onTouch(part)
part.Transparency = 1 --what the function is to do with the brick
part.Transparency = 1  
wait(1)  
wait(1)  
part.Transparency = 0  
part.Transparency = 0  
     end  
     end  
     brick.Touched:connect(onTouch) --listening event
     brick.Touched:connect(onTouch)  
      
      
May be this would be a good time to talk about passing in a parameter to a function?  I wasn't sure how to add this twist to the page.
May be this would be a good time to talk about passing in a parameter to a function?  I wasn't sure how to add this twist to the page.
--------------------------------------------------------------------
--------------------------------------------------------------------
[[User:cecibean|cecibean]]  22:13, 26 September 2008 (CDT)
[[User:cecibean|cecibean]]  22:13, 26 September 2008 (CDT)

Revision as of 03:14, 27 September 2008

Entire tutorial needs to be re-written to remove the 2nd person speak. This is a manual, not a discussion board. Other than that it's great. ---Mr Doom Bringer 13:41, 17 April 2008 (CDT)

It's not that I want tickets, it's that Anaminous' Script Builder no longer has the :Remove() function, causing scripts here not to work. ⇒OutOfSpace

Why is this referring to a Script Builder? It should be referring to the Studio, where you're SUPPOSED to test scripts. Anaminus 00:03, 6 July 2008 (CDT)

It wouldn't work right. If you put it in a place, then by the time the place loads and the person reaches the place, the script would have been executed already. (Throwing an error in the output, that noone is there to be "head removed") Doing it in a script builder saves time, and is quicker. ⇒OutOfSpace

Well tell them to cut then paste the script. Then the script runs. However it basically resets the script. Ozzypig

Script builder link replacement?

Anaminus's script builder now makes us force to use Remove(). There needs to be another popular script builder to link to.

I think I'll change this to use ROBLOX Studio's Immediate window or whatever it's called.Jedi Knight Krazy 09:53, 31 July 2008 (CDT)

There. No more Script Builder. No more advertisers. We're done here. Jedi Knight Krazy 13:32, 6 August 2008 (CDT)


The head remove script wouldn't work in ROBLOX studio would it? In studio your avatar doesn't appear, so you couldn't remove its head?? user:gordonrox24

The head remove script works with "Player", which is yourself. Test it on the command line in Roblox Studio. MINDRAKER 07:35, 18 September 2008 (CDT)

Lost the beginner's feel

This tutorial seems to have lost the beginner-friendly feel I had originally written. I would greatly appreciate it if someone could go through and help me make this a "beginner's" tutorial again. For someone looking to make an edit, I would ask you to always keep beginners in mind. While writing, ask yourself, could a complete newbie read this and understand what I'm talking about? Jedi Knight Krazy

Some noob...

Can we ban Resay from editing this article? Jedi Knight Krazy 12:36, 11 August 2008 (CDT)

Complete the script -> need to change 'brick' to 'part'

In the 'Complete the script' lesson, the code as it currently stands:

   brick = game.Workspace.Brick 
   function onTouch(part) 

brick.Transparency = 1 wait(1) brick.Transparency = 0

   end 
   brick.Touched:connect(onTouch)

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:

   brick = game.Workspace.Brick
   function onTouch(part)

part.Transparency = 1 wait(1) part.Transparency = 0

   end 
   brick.Touched:connect(onTouch) 
   

May be this would be a good time to talk about passing in a parameter to a function? I wasn't sure how to add this twist to the page.


cecibean 22:13, 26 September 2008 (CDT)