I have no idea where to start. In one of my maps I want to make a pitfall, and I know what to do to make the part move, but I can't make a touch detector. Is there a specific object I don't know about, or is there a script I have to enter to make it know when a person touches it?
Yes, it's called the Touched Event.
Here's an example
1 | script.Parent.Touched:connect( function (hit) |
2 | print ( "AH! Someone or something touched me!" ) |
3 | end ) |
If you want to know if it's a ROBLOXian, here you go.
1 | script.Parent.Touched:connect( function (hit) |
2 | if hit.Parent and hit.Parent:findFirstChild( "Humanoid" ) and game.Players:GetPlayerFromCharacter(hit.Parent) then |
3 | print (hit.Parent.Name.. " has touched this brick" ) |
4 | end |
5 | end ) |
This function fires when a particular part you can define is touched:
1 | local part = script.Parent -- Location of part to touch |
2 |
3 | part.Touched:connect( function () |
4 | -- Rest of script goes here |
5 | end ) |