Is there a way to detect when a part touches another part?

In my game, I want to make when a sphere touches something it can destroy, the touched part will be destroyed, but the script doesn’t count the sphere using the part.Touched method and hit:IsA(“BasePart”) function.

1 Like

Simply just,

Script.Parent.Touched:Connect(function(touched)
 if touched:IsA("BasePart") then
  touched:Destroy()
 end
end)

Should work.

Sphere went past the part with enough given time to process it, but still didnt detect anything.

How are you moving the sphere?

TweenService, 5 seconds to move 256 studs from HumanoidRootPart

Tweening a part into another part does not cause the Touched event to trigger because CFrames are processed separately from physics. The only way you would be able to achieve this is to constantly run :GetTouchingParts() on the touched part and looking for the Sphere within the returned table.

1 Like

I will try to do that, thank you