KeyFrameSequence, is it possible to make it play?

Hi, this is my second post, and it’s a fairly basic question, the title says it all really, but is their a way to make a KeyFrameSequence play via a script? i’m just curious

Yes, by arranging all the keyframes in the table in chronological order, and then playing all the poses in each keyframe.

You can play a pose by taking the Pose.CFrame into the Motor6D.Transform

Hi, thanks for telling, i am not the smartest scripter in the world, do you think your able to explain a bit more? thanks!

a basic structure of a keyframe sequence would be like this:

KeyframeSequence-[

Keyframe-[
    Pose -- Has CFrame in this-[
        Some more poses based on hierarchy
    ]
]

]

The arrangement of the poses depends on the hierarchy of the rig.
Notice that if you move the torso in the animation editor, it moves all the other parts along with it.

The CFrame inside each pose will go into the Motor6D.Transform.
You can tween the cframes to get interpolation

I don’t have any example code because im not the greatest scripter either, but i can give you a general outline of what the code does.

  1. Get the sequence and the rig that you want to play the sequence on

  2. Sort all the Keyframes directly under the sequence in chronological order (NOTE: Keyframes are always a child of a sequence, so use :GetChildren())

  3. Loop through the sorted keyframes again, and then use GetDescendants()) to get all the poses in that specific keyframe.

  4. Get the Part that is affected by using the name of the pose and :FindFirstChild()

  5. Get the Motor6D to play on by using :GetJoints() on the Part from Step 4, Loop through the table of joints returned by :GetJoints() and find the Motor6D that the Part0 is equal to the Part from Step 4

  6. Now you have your Motor6D, play your Pose from Step 3 by tweening the Transform property of the Motor6D

  7. After looping through all the poses in the current keyframe, record the time of the keyframe (not tick(), but Keyframe.Time)

  8. When you go to the next keyframe, get the time of this keyframe and subtract it to the time that you recorded at Step 7.

  9. Wait the absolute value of the number gotten from Step 8.

  10. Repeat Steps 3-9 on all the keyframes until there are no more.

  11. Tween all the Motor6Ds in the rig back to its original value (unless if its looped, then repeat Step 10)

Done (ik its a lot, and it might be wrong)

10 Likes

Motor6D? isn’t that for a custom character? if so, i’m trying to do it for a regular avatar if thats possible, any ideas if so?

Regular characters use Motor6Ds to move too
A rig always uses Motor6D for animation joints

oh right i forgot about regular characters having motor6d’s, dam i really lost my brain today

1 Like

image i’m not the smartest person in terms of scripting, but so far is this how it would go?

edit: no it is not, i am quite dumb, sorry

extremelly late but i invented way to play them KeyframeSequance to Animation 2.0

From my experience, you can upload the Keyframe Sequence, and use its Asset Id as the AnimationId for an Animation, which you can use.