nothing more than what the title says, i want to know this because this happened to me some time ago with getmarkerreachedsignal, and now i want to try keyframe reached.
forgot to add to the title, if the script is running and the animation gets stopped BEFORE the certain keyframe was reached
Yes, it will, and it is going to be resumed the next time it is reached.
Example:
-- Suppose this animation is longer than 1 second
task.spawn(function()
animation:Play()
animation.KeyframeReached:Wait() -- yield
print("Reached when played again")
end)
task.wait(1); print("Stopping")
animation:Stop()
task.wait(1); print("Playing again")
animation:Play()
If this poses a problem, I have few solutions for canceling on top of my head:
I see you’ve marked the solution already, but just in case, sure, exactly like in the point 3, except :Once() is replaced by :Connect().
Don’t worry, coroutines are really not complicated, in the above cases they just wrap code and cancel the executed function later, so it doesn’t reach the end. Even the functions called in :Once() or :Connect() are ran in their own threads.