I am trying to use a while function and it is only supposed to go when 3 variables are false.
elseif firetype == 2 then
if not firing or reloading or empty then
firing = true
repeat
shoot()
until firing == false
end
empty is supposed to be set to true when out of ammo and mags and is at the end of the Shoot() function
firing is set when clicked
reloading is set when reloading
when I use the tool with no more ammo it lags a lot and prints that it exhausted the execution time
I think this is because the loop is running while all of the if and elseif gates are false but the Print() at the end doesn’t fire.
Just remember I think the script still carries on looping even if the function is resumed or played so your task.wait() in the function by itself would be useless. Do task.wait(the total amount of wait you have in function), in the loop