I’ve got reloading along with reload cancelling that I made a while ago, and I recently found a glitch where you can spam the semi(and likely full auto) weapons while spamming r and basically keep shooting without having to really reload, it looks like this
function reload()
if canReload == true and humanoid.Health > 0 then
canAim = false
Reloading = true
canShoot = false
debounce = true
reloadTrack:Play()
tool.Reload:Play()
wait(ReloadingTime)
if Reloading == true then
Reloading = false
debounce = false
canSlide = true
canShoot = true
if Sprinting.Value == false then
canAim = true
end
end
end
end
end
V The code for cancelling V
here is cancle coad
function cancelReload()
if Ammo ~= 0 and humanoid.Health > 0 then
Reloading = false
canShoot = true
tool.Reload:Stop()
reloadTrack:Stop()
canSlide = true
canShoot2 = true
canAim = true
canReload = true
canReload2 = true
delay(0.2, noDebouncer)
end
end
I’ve got debounce on firing and reloading, but they get overridden when you cancel reload, what’s going on here?
You can possibly add a delay or wait until you set “canShoot” to true, I believe since you are setting it to true immediately, it’s allowing it to spam it. I’m not necessarily sure if that’ll work, but it’s worth a try ay
I’ve tried that solution earlier with a “currentlyfiring” variable that I had a delay of 0.3 before it was set to false, and all the areas handling reload having a condition that it should be false. All this did was add a kind of weird delay to reloading after shooting, and it didn’t really do anything to fix the original issue
What’s happening is you’re constantly changing Reloading, while reload() is still running
This means that every time you change Reloading to true outside of reload(), it’ll still replenish your ammo as long as Reloading == true when the if statement runs.
What I would do is make a new bool variable inside reload(), named “cancelled” for example, and change it to false every time the tool is activated (or whatever your fire keybind is), then check if the reload was cancelled at the if statement.
I usually set reloading equal to tick() then I set a local variable inside reloading equal to reloading, then I check if reloading = localvar after the wait. This means to cancel a reload you just need to change the value of reload and it won’t be able enter the if statement to actually finish the reload and update the ammo. I usually change the value of reload to false to cancel so that I can still determine if they are currently reloading so it doesn’t reset if I press the button twice.
Something like this.
local reloading = false
local canShoot = true
function cancelReload()
reloading = false
canShoot = true
end
local function reload()
if reloading then return end —on mobile and don’t want to tab more than necessary
reloading = tick()
canShoot= false
local reloadCheck = reloading
wait(5)
if reloading == reloadCheck then
—reload wasn’t canceled. Change ammo.
cancelReload() —resets the variables. Doesn’t actually cancel after it’s made it into this if statement
end
end
cancelled should be defined within mainLoad(), as well as the tool.Activated/UserInputService connection, otherwise you’re having the exact same issue as before.
It’s being set to tick to give it a unique ID essentially. But if you mean if it’s spelt correctly to match up with how you did it, I forgot to capitalize it.