Answered by
4 years ago Edited 4 years ago
Here is an example of touching a teleport part:
04 | local part 1 = workspace:WaitForChild( "Part1" ) |
05 | local part 2 = workspace:WaitForChild( "Part2" ) |
07 | local debounceTable = { } |
16 | part 1. Touched:Connect( function (hit) |
17 | if hit.Parent:FindFirstChild( "Humanoid" ) and table.find(debounceTable,hit.Parent) = = nil then |
18 | table.insert(debounceTable,hit.Parent) |
19 | hit.Parent:MoveTo(part 2. Position) |
21 | table.remove(debounceTable,table.find(debounceTable,hit.Parent)) |
25 | part 2. Touched:Connect( function (hit) |
26 | if hit.Parent:FindFirstChild( "Humanoid" ) and table.find(debounceTable,hit.Parent) = = nil then |
27 | table.insert(debounceTable,hit.Parent) |
28 | hit.Parent:MoveTo(part 1. Position) |
30 | table.remove(debounceTable,table.find(debounceTable,hit.Parent)) |
Try this page next time! (And make sure to hit "View Source" if you're going to copy my code)