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

Animation run on tool Mouse.Button1Down?

Asked by 7 years ago
local Tool = script.Parent
local Player = game.Players.LocalPlayer
local animation = script.Parent.Animation

Tool.Equipped:connect(function(Mouse)
    Mouse.Button1Down:connect(function()
        local animTrack = Player.Humanoid:LoadAnimation(animation)
        animTrack:Play()
    end)
end)

Not sure of the issue.

1 answer

Log in to vote
0
Answered by 7 years ago
local Tool = script.Parent
local Player = game.Players.LocalPlayer
local animation = script.Parent.Animation

Tool.Activated:connect(function()
    local animTrack = Player.Humanoid:LoadAnimation(animation)
    animTrack:Play()
end)

Tool.Activated is a better way than the one you did, and should resolve the issue! :)

Ad

Answer this question