I have a function to reload my gun. I cancel the reload when the tool is unequipped.
script:
local function ReloadFunction()
local ReloadAnimationPlay = Animator:LoadAnimation(ReloadAnimation)
ReloadAnimationPlay:Play()
Tool.Unequipped:Connect(function()
IsReloading.Value = false
ReloadAnimationPlay:Stop()
print("Reload Cancelled")
return
end)
print("Is Reloading!")
task.wait(ReloadTime)
if IsReloading.Value == true then
Ammo.Value = MaxAmmo.Value
Debounce = true
IsReloading.Value = false
print("Reloaded")
end
end
problem is, the function only checks if the tool is reloading after a set amount of time, which means that if a person unequips and reloads again before the time, the reload will still count. i dont know how to stop the function when the tool is unequipped