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

How Do You Make An Animation Run On Click Of A Tool?

Asked by 3 years ago

I am trying to get my animation to run when a player activates the tool. I have tried many times and it has not worked. Local Script inside of the tool:

script.Parent.Equipped:Connect(function(Mouse) Mouse.Button1Down:Connect(function() animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) animation:Play() end) end)

script.Parent.Unequipped:Connect(function() animation:Stop() end)

0
FYI It runs the Animation thats inside of the tool. minerpro_2 0 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Try this idk

local animation
local mouse = game.Players.LocalPlayer:GetMouse()

script.Parent.Equipped:Connect(function()
    mouse.Button1Down:Connect(function() 
        animation =                                              
        game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) 
        animation:Play() 
    end)
end)

script.Parent.Unequipped:Connect(function() 
    animation:Stop() 
end)
0
Does it have to be R6? minerpro_2 0 — 3y
0
should work with both vortex767 20 — 3y
0
Does it work with meshes minerpro_2 0 — 3y
0
its just your script but added onto vortex767 20 — 3y
Ad

Answer this question