Hello. I want to make that a Block with the name "Part1" detect if a Block with the name "Part2" touch the Block(with the name "Part1"). How it works?
Touched allows you to fire a function when one part touches another.
Check if the Part it touched is called Part2
1 | local Part 1 = workspace.Part 1 ; |
2 | Part 1. Touched:connect( function (hit) |
3 | if hit.Name = = "Part2" then |
4 | -- Touched! |
5 | print ( "Touched" ) |
6 | end |
7 | end ) |
This checks if a Part in Workspace touched a Part called Part2 and prints Touched if it did