Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to trigger a Touched event by moving the part with a script into another part? [Answered]

Asked by 7 years ago
Edited 7 years ago

This question has been solved by the original poster.

Moving with CFrame or changing the position of a part so that it hits another part will not trigger the Touched event. (Shown below)

Is there an alternative solution to what I'm trying to do, or a workaround?

part1 = Instance.new("Part")
part2 = Instance.new("Part")
part1.Anchored = true
part2.Anchored = true
part1.Parent = workspace
part2.Parent = workspace

part2.CFrame = CFrame.new(5, 0, 0)

part1.Touched:connect(function(hit)
    hit:Destroy()
end)

while wait(1) do
    part1.CFrame = CFrame.new(0, 0, 0)
    wait(1)
    part1.CFrame = CFrame.new(5, 0, 0)
end
2
Use the GetTouchingParts method Perci1 4988 — 7y
0
Please put [SOLVED] in your title instead of answer so it can be correctly marked by the system. antonio6643 426 — 7y

Answer this question