here's the script:

wait()
local player = game.Players.LocalPlayer

local ev = workspace.GlockEvents.GlockShoot
local tool = script.Parent
local gun = tool.gun.Pipe
local ammo = player.PlayerGui.AmmoGui.Frame.AmmoA.Ammo

local CanClick = true

tool.Equipped:Connect(function(Mouse)
	
	Mouse.Button1Down:Connect(function()
	
	local Mouse = player:GetMouse()
	
	local hit = Mouse.Hit
	
	if CanClick then
        CanClick = false
	
	if
	  ammo.Value > 0
	then
		
		
	
	ev:FireServer(hit,tool)
	
	
	wait(1)
	
	CanClick = true

		end
	   	end
	end)
end)
 

everything works perfectly except checking if ammo.Value is above zero. It does do what needs to be done if the ammo is above 0 and doesn't if it's not but after the value goes back up above zero it acts like it's still 0. Any ideas how it could keep checking if the value gets above 0?

2 comments

0

You’re probably changing the ammo value on the client. Do it on the server if you aren’t.

0

learn to count