so ive understood that functions, instead of using the values provided in the parameters end up making their own different variables
right now i have two ability slots, one bound to Q and the other one E, and there would be a system where you could shuffle them around and get new ones
however…
the cooldowns for these abilities dont work as intended
right now im trying to return the cooldown from the function so i can task.wait it where the function is called but it just wont work?
abilitytrack.Ended:Connect(function() --this is the function
newHitbox:Stop()
print("returned") --prints when its supposed to
return abilitycd
end)
elseif attack == "e" then
if db == true or ecd == true then return end
db = true
ecd = true
local a = funcs[plr.AbilityE.Value](char, ecd)
print(a)
local waittime
repeat task.wait() until a ~= nil
print(a)
db = false
task.wait()
ecd = false
end
There should be shared_cooldown : boolean flag then.
You check it also before handling input.
If it’s the same as ability cooldown then you do not need separate cooldowns for each ability so it’s OK to remove them for cleanup reasons and use one shared_cooldown for everything.
If not then you can do