I first tried just making the animation in a local script but I was told I probably couldn't do that. I tried making it in a server script then playing it from a tool, but the animation still wont load.
-- Server Script
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if plr.Backpack:FindFirstChild("Knife") then
local swingAnim = Instance.new("Animation",plr.Backpack.Knife)
swingAnim.AnimationId = "rbxassetid://4928252907"
swingAnim.Name = "knifeSwing"
elseif char:FindFirstChild("Knife") then
local swingAnim = Instance.new("Animation",char.Knife)
swingAnim.AnimationId = "rbxassetid://4928252907"
swingAnim.Name = "knifeSwing"
end
end)
end)
-- Tool Script
script.Parent.Activated:Connect(function()
local swingAnim = script.Parent:WaitForChild("knifeSwing")
local swingTrack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(swingAnim)
swingTrack:Play()
print("swing")
end)

1 comment
Thank you, just to confirm, I do have to use a server script to make an animation instance right?