the code in this, works as intented. But i want to add a double trouble in the future. when its required for two different players, and say one player uses one of their abilities: for some reason the other player cannot use ANY other abilities until canattack = true.
You would need to do a player-based debounce. Right now, it’s module-wide using 1 local variable.
So if one player uses a move and the local variable is set to true, it will affect everyone.
You should make a table with the player’s name and their own canattack variable, or the last time they used the ability
for example
local PlayerDebounces = {} -- table for the individual cooldowns
PlayerDebounces[player].canattack = false -- setting it to false
-- replace player with the player variable and so on
And when you require it from a server then a local script you can specify which code will be used, see the the image above RunService:IsServer() elseif RunService:IsClient()