#Spam click of tool.activated
1 messages · Page 1 of 1 (latest)
You dont check if CanShoot == true
if isShooting and not canShoot then return end
u can do that
Ok instead of CanFire = false, do
Tool.ManualActivationOnly = true
wait(0.1)
Tool.ManualActivationOnly = false
Ah i understand. Before the while loop, do CanFire = false and after loop, CanFire = true
Remove all the CanFire things inside of the loop and in the begonning of the function, do if not CanFire then return end
I found this solution
local isShooting = false
local shootDelay = false
tool.Activated:Connect(function()
if isShooting then return end --if false stop
if currentAmmo > 0 then
while isShooting do
task.wait()
if not shootDelay then
isShooting = true
playSFX("shoot")
shootBullet:FireClient(player)
currentAmmo -= 1
updateGuiEvent:FireClient(player, currentAmmo, currentReserve)
if currentAmmo == 0 then
isShooting = false
end
shootDelay = true
task.wait(gunInfo["Fire Rate"])
shootDelay = false
end
end
end
end)