Will this cause leaks?

My experience uses RaycastHitbox for hitboxes and one issue I’ve been facing, that once using the same hitbox in a different script, the hitbox in the original script (which is always in the tool) is ceased to exist, the metatable still exists but the OnHit signal does not fire anymore. I tried to fix this, with firing a bindable event to the tool everytime the hitbox in the different script is finished, creating a new one, (I destroy the old one of course), but I wanna know if it’ll cause leaks or not.

Resources.Events.RecreateHitbox.Event:Connect(function()
	HitboxHandle = HitboxH.new(Handle)
	HitboxHandle.RaycastParams = Raycast
	Connection = HitboxHandle.OnHit:Connect(function(Hit:BasePart?, HitHumanoid:Humanoid?)
	end)
end)

If the object which would trigger an event goes away, the event also goes away. So what you’re doing is the right way and will not leak anything.

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