this is for ability cancelling
how would i go about cancelling a move (while its running) from the outside?
ive used coroutines and task.spawn, but im trying to get a jjs effect where the function yields and THEN the function returns the cooldown
my utility script:
module.RegisterMove = function(info)
local Player = info.Player
local Function_ = info.Function
if not Player or not Function_ then
return 0
end
if Moves[Player] then
module.CancelMove({Player = Player})
end
local PlayerFunc = Function_(info.Sending or {})
if not PlayerFunc.Move then
return 0
end
local cooldown = PlayerFunc.Move()
Moves[Player] = {
Move = info.MoveName,
Cooldown = cooldown or PlayerFunc.Cooldown or 0
}
return Moves[Player].Cooldown
end
an example function:
module["YOU FOOL!"] = function(info)
local function move()
info.Player:SetAttribute("CanAttack", false)
print("you fool!!!")
wait(5)
print("done")
info.Player:SetAttribute("CanAttack", true)
return 65
end
return {Move = move}
end