-- Import animation
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=219254264"
-- Local variables
local animTrack = nil
local canPlay = true
local deb = false
function playGrabAnim(Source)
if canPlay then
local player = game.Players.LocalPlayer.Character
canPlay = false
animTrack = player.Humanoid:LoadAnimation(animation) -- Load animation into Humanoid
animTrack.KeyframeReached:connect(function(keyframeName) -- Bind function to KeyframeReached event
end)
end
end
script.Parent.Activated:connect(function()
if deb == false then deb = true
animTrack:Play()
end
wait(2)
deb = false
end)
Also could you tell me how i would disable the arm from going up when the tool is equipped?

4 comments
There's nothing wrong with that code, you should use it from a Server Script though.
its within a tool though.
I know, but Animations won't display on the server if loaded from an instance created from the client.
You'll have to access the player differently, and I suggest looking into RemoteEvents and ModuleScripts.