|
| 26 Jul 2017 04:27 PM |
| How would I get a part that triggered the function. I have 4 parts connected to a function but I want to be able to tell which part was touched. |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2017 04:30 PM |
Which function are you talking about? Is it an ontouched function? The touched event sends the part that touched it as a parameter. |
|
|
| Report Abuse |
|
|
DevJoas
|
  |
| Joined: 17 Dec 2014 |
| Total Posts: 627 |
|
|
| 26 Jul 2017 04:31 PM |
http://wiki.roblox.com/index.php?title=API:Class/BasePart/Touched
Please read this. |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2017 04:36 PM |
| It is an ontouched function but I don't want the part of the player, I need to know what part/block was touched. |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2017 04:41 PM |
An ontouched function looks like this.
function onTouched(hit) //do stuff end script.Parent.Touched:connect(onTouched)
In this script, there are two objects touching, the brick that the script is inside of, and the block that touched it.
Usually, you would put this script inside of say, a kill brick. In this case the kill brick would be script.Parent, and the part that touched it, probably the player's foot or head, would be 'hit'. |
|
|
| Report Abuse |
|
|