So basically I got a gun system and i got a script that makes it drop bullet shells but the problem is it drops the shells when the gun is empty. Heres the script:
local tool = script.Parent
local shell = game.ReplicatedStorage:WaitForChild("PistolShell")
tool.Activated:Connect(function()
local shellClone = shell:Clone() shellClone.CanCollide = true shellClone.Parent = workspace wait() local shellPos = script.Parent.Bolt.Position shellClone.Position = Vector3.new(shellPos.X, shellPos.Y, shellPos.Z) wait(2) shellClone.CanCollide = false
end)
Thanks
I had the same problem but for a Garand ping sound, but I do not know if you use a value for your ammo counter. Either way, it should work.
tool.Activated:Connect(function() if (YourAmmoCounter).Value >= 1 then local shellClone = shell:Clone() shellClone.CanCollide = true shellClone.Parent = workspace wait() local shellPos = script.Parent.Bolt.Position shellClone.Position = Vector3.new(shellPos.X, shellPos.Y, shellPos.Z) wait(2) shellClone.CanCollide = false end end)