Detecting touch efficiently

In my game I would like to have 2 large, invisible parts. I’m trying to detect when something enters it. The system is sort of like a collection system, the player brings it into this part and it rewards them. The issue I run into though, is that this will be a big part that multiple characters will be running inside of etc. Which means while I may not be using it, it will constantly be picking up all of these parts of characters moving around inside.

Am I wrong to worry about this? And is there a better way I’m just not thinking of?

1 Like

Though I am not good at scripting, I don’t think there’s anything to worry about here, as long as there is debounce and a player check. Maybe u can use region3 to make it even better (not too sure).

You could use Region3, but there’s already a module that offers much better support for what you’re trying to do.

1 Like

I don’t suggest relying off other people’s packages, especially for something simple like detecting a touch, it’s not a secret that .Touched is pretty bad so like mentioned Region3 does work.

I’ve also done thing’s like

local TouchingParts = ...:GetTouchingParts() --- "..." being you're part.

if #parts == 0 then
   print(“Nothing is touching me!”)
else
   --- do whatever here...
end

This is probably less efficient.