How can i cancel and/or pause a thread?

Another post because i’m in a dev mood i think. In my fighting game, players can cancel their moves into other moves, and when performing a move, if they’re hit by someone else, their current move is cancelled and they enter hitstun, basic fighting game law stuff. But i also have supers in my game which upon activation, will freeze / pause nearby players and eventually resume whatever they were doing. I’m wondering if there’s a certain way to cancel threads? I know theres stuff like task.cancel() and coroutines but im wondering which one in specific i should use.

1 Like

task.cancel() are for threads made with the task library (task.spawn(), task.defer()), coroutine.close() are for threads made with standard coroutines (coroutine.create()).