|
| 17 May 2013 11:56 AM |
Make a brick that does the following:
Change the color when touched.
Kills the player that touched it
Moves the brick to a random location between 0 and 20 on all axis
Inserts a message into workspace that says somebody touched the part
The name of the brick in workspace is called "Part".
-- Fᴏʟʟᴏᴡ ᴍᴇ ᴏɴ Tᴡɪᴛᴛᴇʀ @ɢʟᴀssᴋʟᴀʀᴛRBLX -- |
|
|
| Report Abuse |
|
|
|
| 17 May 2013 11:59 AM |
Wiki the onTouched() function.
The lonely sentinel.. |
|
|
| Report Abuse |
|
|
|
| 17 May 2013 12:41 PM |
Wow. Your are supposed to read the tutorials/wiki so that you understand how to do that. It's an assessment to see if you have learned everything, so go back and read the tutorial.
Soup's on, everybody! ~LuaLearners Writer~ |
|
|
| Report Abuse |
|
|
|
| 17 May 2013 03:46 PM |
I know. The reason why I posted it is so I can see an example. I don't understand functions.
-- Fᴏʟʟᴏᴡ ᴍᴇ ᴏɴ Tᴡɪᴛᴛᴇʀ @ɢʟᴀssᴋʟᴀʀᴛRBLX -- |
|
|
| Report Abuse |
|
|
|
| 17 May 2013 03:52 PM |
function onTouched(hit) --Do your stuff end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 17 May 2013 03:57 PM |
Thanks. Can anyone help me learn functions?
-- Fᴏʟʟᴏᴡ ᴍᴇ ᴏɴ Tᴡɪᴛᴛᴇʀ @ɢʟᴀssᴋʟᴀʀᴛRBLX -- |
|
|
| Report Abuse |
|
|
|
| 17 May 2013 08:13 PM |
functions are just parts of script that fire when you say. Example.
------------------------ print ("Script Fired") ------------------------ This will fire when the script is enabled, printing "Script Fired" in the Output window.
------------------------ function Hello() print ("Script Fired") end
script.Parent.Touched:connect(Hello) ------------------------ This wil fire when the "script.Parent" gets touched. Aka, the part the script is in.
------------------------ Part = script.Parent
function Name() print ("Script Fired") end
Part.Touched:connect(Name) ------------------------ This is the same as above, but I made a Variable. Notice the connection line is different.
The name of the function comes after "function". This allows you to tell the script what to fire. Notice, my silly names above. It doesn't matter what you name it, as long as your connection line can find it.
|
|
|
| Report Abuse |
|
|