Projectile script efficiency

I havent really been active on roblox in quite some time for playing or developing. Anyway I been getting back into it and im looking back on where I left off. (not very good)

I’m just curious if this is efficient and won’t cause any memory leaks? The function is fired when the projectile hits something or ends; if the projectile lasts longer than 10 seconds or loses all velocity.

	function projectile:remove()
		-- Disconnect the update connection.
		self.loop:Disconnect()
		-- And now set the update connection object to nil.
		self.loop = nil
		print("removed")
	
		-- Clear the metatable.
		setmetatable(self, nil)
	end

When I made this module for the projectile a few years back I wasn’t very good at scripting, nor am I right now but I have a bit more knowledge though I’m still not 100% sure.

edit::
self.loop is what controls the projectile actually firing-

self.loop = nil
self.loop = runService.Heartbeat:Connect(function(deltaTime: number)
	self:fire(deltaTime)
end)

^^ thats whats in the .new() part of the module.

No memory leaks here unless you’re keeping a reference to the projectile elsewhere after calling remove() .