PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Loop

KeyframeSequence

bool

Determines whether the animation created from the KeyframeSequence will be looped. When set to true the animation will continuously repeat each time the animation finishes.

When an AnimationTrack has been created from an Animation, its AnimationTrack/Looped property will default to the original KeyframeSequence value. Note this value can be overwritten.


Code Samples


KeyframeSequence Instantiation

This sample demonstrates how a basic KeyframeSequence can be created.

-- create the keyframesequence
local keyframeSequence = Instance.new("KeyframeSequence")
keyframeSequence.Loop = false
keyframeSequence.Priority = Enum.AnimationPriority.Action

--  create a keyframe
local keyframe = Instance.new("Keyframe")
keyframe.Time = 0

-- create sample poses
local rootPose = Instance.new("Pose")
rootPose.Name = "HumanoidRootPart"
rootPose.Weight = 0

local lowerTorsoPose = Instance.new("Pose")
lowerTorsoPose.Name = "LowerTorso"
lowerTorsoPose.Weight = 1

-- set the sequence hierarchy
rootPose:AddSubPose(lowerTorsoPose) -- lowerTorsoPose.Parent = rootPose
keyframe:AddPose(rootPose) -- rootPose.Parent = keyframe
keyframeSequence:AddKeyframe(keyframe) -- keyframe.Parent = keyframeSequence

-- parent the sequence 
keyframeSequence.Parent = workspace