I’m working on a gun system for my new game, I have everything else set-up and working though when I hold to shoot, then let go it sometimes does not stop firing- it seems to be pretty random whether is stops or keeps firing. I’ve tried using UserInputService but it responds the same way. This is the code:
Mouse.Button1Down:Connect(function()
if FireMode == "Semi" then
if Ammo > 0 and Equipped and not Firing and not Reloading and not check then
check = true
spawn(Shoot)
wait(FireRate)
check = false
end
elseif FireMode == "Auto" then
MouseDown = true
while Ammo > 0 and Equipped --[[and not Firing]] and not Reloading and MouseDown and not check do
check = true
spawn(Shoot)
wait(FireRate)
check = false
end
end
end)
Mouse.Button1Up:Connect(function()
if Equipped and Firing and FireMode == "Auto" then
MouseDown = false
FlashEffect.Enabled = false
SmokeEffect.Enabled = false
wait(FireRate-0.05)
Firing = false
RecoilAnim:Stop()
RunService.RenderStepped:Wait()
end
end)
There are no errors. Thanks.