Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I am attempting to load a KeyFrameSequence into the player's humanoid, how to fix the error?

local animation = workspace["animation"]
local track = workspace.Dummy.Humanoid:LoadAnimation(animation)
while true do wait(1.05)
	track:Play()
	end

The error i get is

  17:05:01.728 - LoadAnimation requires an Animation object
17:05:01.774 - Stack Begin
17:05:01.775 - Script 'Workspace.Script', Line 2
17:05:01.776 - Stack End

This is because im using a keyframesequence instead of a normal animation. and i dont wanna export the animation to roblox.

1 answer



-- 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


1 comment

0

No I'm trying to play a animation thats already existing in workspace. Not create it!

This discussion is preserved as it was. New answers, comments, and votes are closed.