local Damage = game.ReplicatedStorage.Guns.Colt.Damage.Value local Ammo = game.ReplicatedStorage.Guns.Colt.Ammo.Value local MaxAmmo = game.ReplicatedStorage.Guns.Colt.MaxAmmo.Value local AmmoReloadTime = game.ReplicatedStorage.Guns.Colt.ReloadTime.Value local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local Handle = script.Parent.Handle local Colt = script.Parent script.Parent.Activated:Connect(function() print("activated") if Ammo ~= 0 then print('enough ammo') game.ReplicatedStorage.Guns.Colt.Ammo.Value = game.ReplicatedStorage.Guns.Colt.Ammo.Value - 1 print('removed ammo') if Mouse.Target~= nil then if Mouse.Target.Parent:FindFirstChild('Humanoid') then print('targetted player') game.ReplicatedStorage.Guns.Fire:FireServer(Damage, Ammo, MaxAmmo, Mouse, Mouse.Target, AmmoReloadTime) end end else print('no ammo') end end)
iin the else statement, it never prints or does what i put in the else statement. the ammo number goes to negative and still damages players what do i do to make it stop when the ammo is = 0
You should check if the player has more than 0 ammo, so you would need to use ">" instead of "~=" in line 14.
It has been fixed, i just needed to remove the .Value from the variable and put it in the if statement line