Tried creating a gun. I did it, but there is a bug. So whenever you shoot the gun, it wastes 1 bullet, obviously, and when the gun has 0 bullets, it reloads of course. BUT, wheneveryou unequip the weapon and re equip it, whenever you shoot, you lose and extra bullet. Lets say the gun wastes 1 bullet when shot, i unequip, then re equip, and then the gun starts losing 2 bullets per shot? I do that again, then it starts wasting 3 bullets per shot. I’m guessing the bug is somewhere right here? Here is the local script:
script.Parent.Activated:Connect(function()
if enabled == true then
wait(.2) script.Parent.Fire:FireServer(mouse.Hit.p) tool.Handle.Fire:Play() maxAmmo.Value -= 1 local LoadHumAnim = Humanoid.Animator:LoadAnimation(script.Fire) LoadHumAnim:Play() if maxAmmo.Value < 1 then enabled = false tool.Handle.Reload:Play() local LoadHumAnim = Humanoid.Animator:LoadAnimation(script.Reload) LoadHumAnim:Play() wait(2.2) maxAmmo.Value = 10 enabled = true end