So I made a projectile, however when the projectile passes through too many parts at once, it causes lag.
Something I tried to do was:
local debounce = false
part.Touched:Connect(function(hit)
if debounce then return end
debounce = true
-- my code
debounce = false
end)
However, this did not do the trick since the part's touched event was still firing everytime it passes through a part. Does anyone know any solutions to fix the lag issue?

5 comments
Use TouchEnded event for debounce https://developer.roblox.com/api-reference/event/BasePart/TouchEnded
Ok I will try that
Try To loop through GetTouchingParts since that returns a table, it might lag less, Touched spawns a thread.
How often should I loop through GetTouchingParts?
Also I'd have to give all of my projectiles a TouchInterest right? (since all my projectiles are noncollide)