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

My Ammo Checker For My Gun Script doesn't work and there is no error in the output can you help me?

I was gonna make a reload script But I thought "Why Shouldn't I test it first" so I made my ammo checker but the problem was My ammo checker did not work

this is ammo checker

while true do 
if Ammo < 0 then
	CanFire = false

else
	CanFire = true
	end
wait()
end


you can see if the ammo is 0 or Below 0 its making CanFire False

if you want you can see the other lines that I use CanFire

--Shooting The Gun
	local function fire()
		if CanFire == true then
	local ray = Ray.new(tool.Barrel.CFrame.p, (mouse.Hit.p - tool.Barrel.CFrame.p).unit * Range)
		
		script.Parent.Remotes.Shoot:FireServer(tool, ray)
		end
--AutoFire
	mouse.Button1Down:connect(function()
	   button1down = true
		repeat fire() wait(0.199) until
		button1down == false
		CanFire = false

2 comments

0

if Ammo <= 0 ??

0

only works when I drop and pick it up again

1 answer

nevermind It didn't work because it was not in the right code sorry for wasting time :/

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