Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Ammo counting down +1 every time I equip weapon?

Every time I equip a weapon in my game, the ammo count goes down by 1 plus how ever many times I have equipped the weapon during the test. I can tell that is the pattern but I am not sure what to do about it.

script.Parent.Equipped:Connect(function(Mouse)
	local function Reload()
		Reloading = true
		wait(1)
		Ammo = MaxAmmo
		Reloading = false
	end
	
	script.Parent.Activated:Connect(function()
		if Ammo > 0 and not Reloading then
			Ammo -= 1
			print(Ammo)
			script.Parent.GunShot:Play()
			--recoils--
			if Mouse.Target.Parent:FindFirstChild("Humanoid") then
				script.Parent.DealDamage:FireServer(Mouse.Target.Parent, 20)
			end
			
		elseif Reloading == false then
			Reload()
			script.Parent.GunShot:Stop()
		end

1 answer

Delete line 11. I think that should work

1 comment

0

That just takes away the count all together. Maybe there's a different keyword?

This discussion is preserved as it was. New answers, comments, and votes are closed.