Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Problem with playing animation from a tool. (I have to include a question mark so.. ¿?)

Asked by 5 years ago

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.

0
you didnt set the animations parent lol ieatandisbaconhair 77 — 5y
0
yeah thats the solution i guess, set the animations parent ieatandisbaconhair 77 — 5y
0
That's one of the problems, but i found another one, the Motor6D is not being parented to the character's right hand. LinKiNSpitZ 22 — 5y

Answer this question