Quicker Part.Touched Alternative

Are there any quicker and more efficient part.Touched alternatives? because I’m using part.Touched in a script where you throw an object at high speeds but sometimes theres a delay before part.Touched fires.

The script should destroy the part after it hits the ground and it does destroy… but with a kinda delay.

–Video Example
robloxapp-20241120-1719005.wmv (1.8 MB)

Don’t know why theres that delay, anyone have any ideas?

You could turn off CanCollide to make it so it hides the delayed deletion. This improves gameplay and can possibly lower risks of down-ratings.

1 Like

use runservice, but i dont think this is good,

local TableOfParts = {}

game:GetService("RunService").Stepped:Connect(function()
	for i, v in TableOfParts do
		--check the distance between the parts u want to check getting touched and the parts that will get destroyed when touched by these parts
	end
end)

im not sure how are u going to check if its touching though, maybe raycast? and minus the size of them so u see the exact distance between the surfaces of each part, or maybe do a double raycast, from first part then to second part using the position of the first raycast result, so its more accurate, and just check if the distance between these 2 using magnitude is less than 0.1

1 Like

Is this on a server-script? If it is, try a local script, other than that there aren’t a lot of good solutions (that don’t ruin performance.)

1 Like

Part.Touched can be delayed if you’re listening to the touched event from the server but the part is owned by a player. If you were to set the part’s network owner to the server and listen to the touch event from the server, there would be no delay between visual collision and the touch event.

1 Like

Regarding performance however, touched events only bring down performance when you’re detecting more than a few collision objects. judging by the video, you’re only listening for collisions on a projectile, which shouldn’t bring performance down very much on its own.

If you need to detect collisions for alot of objects, I would suggest using collision groups and if possible, disable collisions between projectiles.

1 Like

i mean for anything that requires any sort of accuracy at all i just go to workspace:getpartsinpart(boundingpart) and it returns a table with every single part that is colliding with the boundingpart (for the object that is being destroyed)

1 Like

ill try this out later sorry for the late reply.