Shells Multiplying Every Reload

I made a functioning Double Barrel gun. But there’s a problem, whenever I reloaded the gun. This happened to me :


(Ignore the Background Music)

So, the shells multiplying every reload. I have a code about that clones the shell and reject as the handler racks. I’ll also show you the image of my Double Barrel explorer if it seems to be the problem.

The code below me is related to reloading function with some shell ejecting. There’s nothing related about this besides the other line neither a local script.

function reload(player)
	if not cooldown[player] and gun.Parent == player.Character and ammo.Value < confs.Ammo then
		cooldown[player] = true
		if confs.ReloadWhileInBackpack then
			accept_reload = true
		end
		
		remote:FireClient(player, "Reload")
		
		remote.OnServerEvent:Connect(function(player, status)
			if status == "Racks" then
				handle.ReloadSound.Racks:Play()
			elseif status == "InsertAmmo" then
				handle.ReloadSound.InsertBullet:Play()
				
			elseif status == "ShellEject" then
				
				if confs.ShellEjectPart then
					for i, bullet in pairs(bullets:GetChildren()) do
					
						local clonedBullet = bullet:Clone()
						clonedBullet.Parent = workspace:WaitForChild("BulletWaste") 
						clonedBullet.CFrame = bullet.CFrame 
						clonedBullet.CanCollide = true
						clonedBullet:SetNetworkOwner(player)

					
						local bodyVelocity = Instance.new("BodyVelocity")
						bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
						bodyVelocity.Velocity = (clonedBullet.CFrame.RightVector * -15)
						bodyVelocity.Parent = clonedBullet

					
						game:GetService("Debris"):AddItem(bodyVelocity, 0.1)
						game:GetService("Debris"):AddItem(clonedBullet, 2) 
					end
				end
				handle.ReloadSound.AmmoShell:Play()
				
			end
		end)
		task.wait(confs.ReloadTime)
		
		if accept_reload then
			ammo.Value = confs.MaxAmmo
		end
			
		cooldown[player] = false
	end
end

image_2024-12-20_062156348

I’m not going to reply at this early time but I’ll reply back around 2 PM (UTC +8)

Everytime you reload, you’re creating a new connection. You need to either not do that in the first place or disconnect it after you don’t need it anymore.

I disconnected under “ShellEject” but it dont play other sounds. Only AmmoShell was played.

Yes. Obviously not. The connection is gone. Even if you fire the event again, it’s not gonna do anything. This is a problem with your design.
I would suggest making multiple events for multiple things, not one for everything.