Well, Touched isn't a boolean, it's a script signal. You'll get false because Touched exists as a valid signal but it doesn't return anything, so the statement reads it as nil.
If you want to know what Touched does, it's called as a script signal of the BasePart
family (said family consists of Parts, NegativeParts, UnionOperations, etc.). When Touched fires, it passes the BasePart
that made contact with the BasePart
whose Touched event is listening. For example, if a player's character is R6 and their left leg hits the part listening for Touched, the passed BasePart
will be Left Leg
.
In order to associate any signal with any function (pre-written or post-written), Connect()
is necessary. If no function was previously written for use with the signal, you can define this function within the signal:
1 | BasePart.Touched:Connect( function (hit) |
Or, you can associate an existing function with it:
5 | BasePart.Touched:Connect(foo) |
For the main issue at hand, every Instance has a property called Name
, which is a string that represents the name given to the Instance. This property can be changed by the scripter at will; it's essentially a dynamic property. The rest is up to you.