So I'm making an automatic gun, right? but I noticed a problem with its integrity - that being, you can compromise the intended firerate by double clicking to make it fire much faster. I'm not sure how it happened, but I measured the shots per second and whenever I hold down lmb normally, perfectly fine (5 shots per sec with the occasional 6), but when you click a bit more, it's averaging 6 shots per sec with the occasional 5. Any solutions to prevent this?
#[solved] How to solve automatic weapon problem
13 messages · Page 1 of 1 (latest)
btw heres the relevant code
function fire()
if debounce == false then
debounce = true -- lock period between shots
idleTrack:Stop()
--Playing all the necessary things
script.ShootSfx:Play()
shootTrack:Play()
shootTrack:AdjustWeight(1.2,.1)
shots += 1
wait(firerate)
debounce = false
-- Closing Up
shootTrack:Stop()
idleTrack:Play()
idleTrack:AdjustWeight(1,.1)
end
end
mouse.Button1Down:Connect(function()
isFiring = true
while isFiring == true do
fire()
wait()
end
end)
mouse.Button1Up:Connect(function()
isFiring = false
end)
try
if debounce == true then return end
debounce=true
wait(firerate)
debounce=false
** You are now Level 6! **
@warped dagger Let me know if things dont work
oh ok toodles
oh damn it actually did work thx
awesome sause
bye bye girlie!!!!!
adios