#I am not able to close a coroutine that is inside itself
1 messages · Page 1 of 1 (latest)
does it say it at the first iteration?
It's the only thing in the Move.Clear table so yes.
i don't quite get it, do you plan on adding more coroutines inside Move.Clear?
otherwise why don't you just close it like coroutine.close(Move.Clear.Timer)
not quite sure about the error, but for loops and arrays sometimes suck together
does the EntityFunctions.ForceEnd thingy affect anything about Move.Clear?
** You are now Level 1! **
results in same error
it doesn't
it's a move system, the Move table is
normally the Move.Clear table is automatically cleared when the move has ended
but
since this is a toggle based move
it doesn't do that, and everything inside Move.Clear stays the same, so the coroutine from the if statement above
is the same inside that loop/Move.Clear.Timer
try .wrap instead of create, i remember using create and then switching to wrap many times, or even better task.spawn
it works really similarly: you create with task.spawn (returns thread)
and end it with task.cancel(thread)
i tried this with task.spawn same issue
i'll try again hold on
"cannot cancel thread"
is the error i get
are you 100% sure Move.Clear.Timer isn't nil by the way?
oh wait
i think i got it
i'm 100% sure
you're trying to cancel a thread that is already canceled
am i? i really don't think i am
like i don't think you even need to save it, you can just do:
task.spawn(function() task wait and other stuff...
and no need to cancel
or how would i check
you don't understand what the cancel is for
okay os
not really sure, maybe it becomes nil to avoid memory leaks
you can hold down the parry right, and unhold it
like a block
basically just a block
but the reason why i have task.spawn is so that
i believe you're trying to optimize
when you hold it for too long
it's going to automatically end
that's what force-end function does
lemme make a little
drawing i guess
sorry i was afk
alright
by the way, there's no really need of "elseif Parrying", just "else" (unless you plan to check for more conditions)
i mean yes, but it doesn't really matter either way
but
yeah i know just saying
anyways when you hold F
it will go to the not parrying statement and will make a new thread
if you stop holding F before 1 second is up
it will automatically cancel that thread
uhhhhhh
but it's inside of it
try debugging with some prints, just to make sure everything else works and nothing is nil
the force end just recalls the move function, and because you're already parrying it stops parrying and cancels the thread
it does
i've already checked if things were nil
oh alright
yeah it sounds like something else
probably something obvious tbh
well
i feel like i've seen this error before, but if you're 100% sure the timer thing isn't nil, no idea
you can't normally cancel a thread inside itself
yes
100% sure
but I literally have to be able to
you said the forceend calls the whole function again right? but uhh does Parrying get set to true then? i mean it could be looping recursively
** You are now Level 2! **
no clue
do you really really need coroutines
yes i do
yes
you can use timers with runservice even if it's pretty ugly
but i wasn't sure how to do that
like i guess i could
make an implementation it wouldnt be crazy hard but i wondered if
anyone had a fix to this
because if there is a fix it's just really easy and simple
it's not that hard, just create a timer, increment it, check its value...
yeah i agree
it does get set to true yes, i just removed extra code so you don't have to look at a million lines
yeah not that it's hard but
i just don't really want to if there's some easy fix
the truth is lua kinda sucks, and luau isn't much better, there are alot of painful things like this