I have been working on a simple gun and I have made a reload, ammo, and shooting thing for it. My question is how do I stop the gun from firing after it runs out of ammo?
1 Like
-- Something will wrong but hope this will help you
--You need to have ammo,max_ammo or something like that to make the gun
ammo = 10
max_ammo = 10
--If the gun in fire you need to check it
-- Start Active MouseClick or Tool.Actived here
if ammo > 0 then
ammo = ammo - 1
--Your Fire script here
else
wait(5) -- Time Cooldown
ammo = max_ammo
end
end)
2 Likes
You should put this under a support category next time, to receive the needed support to your problem.
1 Like
Sorry I thought I put it in the right place? But I realized when I looked at it after the post creation that its in cool creations sorry.
Ah thanks for that bit of code. I didn’t consider having 2 variables for ammo.