Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

help with Animation?

Asked by 8 years ago

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

1 answer

Log in to vote
0
Answered by 8 years ago

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.

0
how could i implement it then if i had to work with several different objects ProfessorSev 220 — 8y
0
and to add another layer how could i make it so some animations are overriden by some animations but not others? ProfessorSev 220 — 8y
0
I am unsure what you mean by different objects(scripts??) but if it is like different welds you could use a dictionary and the index would be the object you want to effect. Example running= { ["arm"]="No" } That way you can do the check for the right object... I don't know if that is what you meant. burrokid 5 — 8y
Ad

Answer this question