So i have made a function that will allow me to change the poses of a given weld or part by adjusting their cframes but how can i have it detect if it has been called while it is still running ? like for example if i made the right arm go up in 10 seconds total time waited 5 seconds then made it go down in how could i make the function detect that the first animation was not finished cancel it then execute the second animation?
here is the function
local frames = 25 local function newPose(joint, finishCFrame, length) coroutine.resume(coroutine.create(function() local totalDurration = length * frames local i = 0 while true do joint = joint:lerp(finishCFrame, i) wait(1 / frames) i = i + (1 / totalDurration) if i == totalDurration then break end end end)) end
Well one thing you could try is in your function have a variable named running and set that to false. Then in the while loop set it to true. Then when it exits the while loop set it back to false... This way you can add checks for that variable and if it is false(aka not running) then your function will allow for the animation to run else don't run the animation.