How do I use Key Frame Sequence Animation?

Hey! I am trying to make it so when the tool is equipped and you click it plays a animation. How do I use it like this type?
Script:

local CharCheck = game:GetService("Players").LocalPlayer.Character or game:GetService("Players").LocalPlayer.CharacterAdded:Wait()
local char = game:GetService("Players").LocalPlayer.Character

local Mouse = game:GetService("Players").LocalPlayer:GetMouse()

local Animator = char:WaitForChild("Humanoid").Animator

local WeaponTool = script.Parent.Bayonet
script.Parent.Equipped:Connect(function()
	game.ReplicatedStorage.ConnectM6D:FireServer(WeaponTool.BodyAttach)
	char.Torso.ToolGrip.Part0 = char.Torso
	char.Torso.ToolGrip.Part1 = WeaponTool.BodyAttach
	Mouse.Button1Down:Connect(function()
		Animator:LoadAnimation(WeaponTool.AnimSaves.Stab1)
	end)
end)

script.Parent.Unequipped:Connect(function()
	game.ReplicatedStorage.DisconnectM6D:FireServer()
end)

Tool:
image

5 Likes

Hello, CapCaptan. It seems you got the animation all set up, you just need play it.

Animator:LoadAnimation(WeaponTool.AnimSaves.Stab1):Play()
1 Like

Doesn’t work. I get this error:

12:53:19.565 LoadAnimation requires an Animation object - Client - LocalScript:14

Ah, you need to save the “KeyframeSequence” object to Roblox by right-clicking on it and clicking “Save to Roblox”. You then should place an “Animation” object in “AnimSaves” and get the animation Id from your inventory and replace the object’s AnimationId with that. Make sure to name that animation object to “Stab1”.

7 Likes