animtest

Run Settings
LanguageLua
Language Version
Run Command
script.Parent = owner.Character local runService = game:GetService("RunService") local tweenService = game:GetService("TweenService") local character: Model = owner.Character or owner.CharacterAdded:Wait() local humanoid: Humanoid = character:WaitForChild("Humanoid") local animator: Animator = humanoid:WaitForChild("Animator") local jointNames: {[string]: Weld} = {} local jointDefaults: {[string]: CFrame} = {} for _,joint in ipairs(character:GetDescendants()) do if joint:IsA("Motor6D") then local weld = Instance.new("Weld") weld.Name = joint.Name .. "Weld" weld.Parent = joint.Parent weld.Part0 = joint.Part0 weld.Part1 = joint.Part1 weld.C0 = joint.C0 weld.C1 = joint.C1 local jname = weld.Part1.Name if joint.Name == "RootJoint" then jname = "Torso" end jointNames[jname] = weld jointDefaults[jname] = weld.C0 end end print(jointNames) local function playKeyframeSequence(model: Model,keyframeSequence: KeyframeSequence) local keyframes: {Keyframe} = {} for _,keyframe in ipairs(keyframeSequence:GetKeyframes()) do if keyframe:IsA("Keyframe") then table.insert( keyframes, keyframe ) end end table.sort(keyframes,function(a,b) return a.Time < b.Time end) local currentKeyframe = 1 local nextKeyframe = 2 while task.wait() do currentKeyframe += 1 nextKeyframe += 1 if nextKeyframe <= #keyframes then local tweens: {Tween} = {} local currentKeyframe = keyframes[currentKeyframe] local nextKeyframe = keyframes[nextKeyframe] local kTime = (nextKeyframe.Time - currentKeyframe.Time) / 8 for _,pose in ipairs(nextKeyframe:GetDescendants()) do if pose:IsA("Pose") then local joint = jointNames[pose.Name] if joint then table.insert( tweens, tweenService:Create( joint, TweenInfo.new(kTime,Enum.EasingStyle[pose.EasingStyle.Name],Enum.EasingDirection[pose.EasingDirection.Name]), { C0 = jointDefaults[pose.Name] * pose.CFrame } ) ) end end end for _,tween in ipairs(tweens) do tween:Play() end task.wait(kTime) for _,tween in ipairs(tweens) do tween:Destroy() end end if currentKeyframe >= #keyframes then currentKeyframe = 1 nextKeyframe = 2 end end end local assets = LoadAssets(15822220947) local animation = assets:Get("Kazotsky") playKeyframeSequence(character,animation)
Editor Settings
Theme
Key bindings
Full width
Lines