I'm making a tool that plays an animation when the mouse left button is clicked, i made the script and there's no errors in output, but the animation does not play.
local mo
local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://2347972851"
script.Parent.Equipped:Connect(function(Mouse)
mo = Instance.new("Motor6D")
mo.Parent = game.Players.LocalPlayer.Character.RightHand
mo.Part0 = game.Players.LocalPlayer.Character.RightHand
mo.Part1 = script.Parent.Handle
local anim = Humanoid:LoadAnimation(animation)
game:GetService("UserInputService").InputBegan:Connect(function(input, gui)
if (input.UserInputType == Enum.UserInputType.MouseButton1 and gui == false) then
anim:Play()
print("LOL")
end
end)
end)
script.Parent.Unequipped:Connect(function()
mo:Destroy()
end)
It even prints "LOL" when the mouse button is clicked. If someone knows the problem, please help me.

3 comments
you didnt set the animations parent lol
yeah thats the solution i guess, set the animations parent
That's one of the problems, but i found another one, the Motor6D is not being parented to the character's right hand.