|
| 29 Aug 2012 09:50 PM |
I know that the aggruments for Touched is (Basepart, other part).
So I looked up Basepart in the wiki, it is basically a parent right? What would the porpuse of it be?
And then other part is when the defined part for the function hits the other part right?
Can you please answer my three questions :o
-Tester- |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 09:53 PM |
local Part1 = script.Parent
Part1.Touched:connect(function(Part2) print(Part1 == Part2) -- Will print 'false' end)
Where Part1 is the part that the event is a member of and Part2 is the part that hits Part1. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 09:55 PM |
Ooohhh, so only Part1 will perform the script with contact to Part2?
-Tester- |
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 29 Aug 2012 09:56 PM |
The touched event only returns the other part; BasePart is the type of the argument, and not an argument which is received. It's the same as integer or boolean - It just says what kind of argument will be received from the event.
The other part which is received is the part that touched the defined part, thus running the event. For example, if you have a part named "Teleporter" which is running the Touched event, whenever an object touches this part, it will return the object that touched the teleporter. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 10:01 PM |
So, Basepart will not have the script be preformed when it is touched?
Sorry if I am making you life complicated, if you know of a page that defines this, I would love to see it. :D
-Tester- |
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 29 Aug 2012 10:07 PM |
A BasePart is a class, representing any part object (WedgePart, CornerWedgePart, and any others carrying those properties / events / methods). Any of those will be able to run the Touched event, but for this to happen, you have to first create the connection line for the Touched event on the BasePart.
If you have a script like this:
part = script.Parent part.Touched:connect(function(hit) print(hit.Name) end)
Then it will print an object which hits part, but not an object which hits a parent of part, or an object which hits a child of part. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 10:17 PM |
Ok so, -
> -Wedgepart -- This one is considered a basepart because it is parent to part? > -Part --This is the brick that runs the touched event > -Script --This is the touched event
-if part gets hit, it will print only Part and not Wedgepart or Script, and if the parent or childen get hits none of the parts are printed, correct? |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 10:23 PM |
................| WedgePart BasePart-<{ Part ................| TrussPart ................| CornerWedgePart |
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 29 Aug 2012 10:24 PM |
The WedgePart is a BasePart because it shares many of the same properties as parts have; anything sharing these characteristics can be considered a BasePart. This is mostly for use with :IsA(), because that will allow you to find WedgeParts and all other types of Parts without having to put a different one in for each kind of part. For now, you should forget about this, because it is unrelated to the .Touched event.
As for when the part gets hit, it can print Part, WedgePart, or Script, depending on the code. However, if you are printing the object which has been hit, it will always print Part. Hitting a child or parent will not run the .Touched event. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 10:27 PM |
Alright, Thanks, to you both then :D
-Tester- |
|
|
| Report Abuse |
|
|