Something more optimized than touched

I’m trying to make a merging system. Where you have two things and you can merge them together to get the next object and so on. But i’m having an issue with it getting detected. Touched can only run if the parts are unanchored, and if I unanchor and add weld constraints it starts bugging out when it comes in contact with something. What is the most optimized way to detect collisions with an anchored part?

I don’t think that’s true? Something must be wrong with your code, or the part in question has CanTouched unticked. Here’s a video of an anchored part with a .Touched script working fine:

It only detects the players character if its anchored.

Ah, okay, you could use workspace:GetPartsInBox() as an alternative to touched. It returns the parts inside the part as a table, which you could loop through every RunService.Heartbeat.

Here’s a little example, which makes touched parts red:

	for index, object in workspace:GetPartsInPart(script.Parent, do
		object.BrickColor = BrickColor.Red()

I don’t know how performant this function is, but every game I’ve used it in doesn’t suffer any noticeable performance hits.

1 Like

I will test it out soon. Thanks for the help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.