So here is the script:
local animation = Instance.new("Animation")
animation.AnimationId = "https://www.roblox.com/Asset?ID=1438749801"
local trackanimation = nil
local playability = true
function playAnimation(AnimationSource)
if playability == true then
local plr = game.Players.LocalPlayer
trackanimation = plr.Character.Humanoid:LoadAnimation(animation)
trackanimation.KeyframeReached:connect(function()
print ('Working')
end)
trackanimation:Play()
end
end
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local waituntilback = script.Parent.Parent.Tool.Equipped:connect()
script.Parent.Parent.Tool.Equipped:connect(function()
if not script.Parent.Parent.Tool.Equipped:connect() then
playAnimation(waituntilback) else
playAnimation()
end
end)
But how do I make it where it shows up in the game and How do I make it where it's only a Mouse click. This script only when you pull out the tool it starts the animation.

1 comment
Okay, so the script you gave me is working but when I saw this in the script analysis it said this: W003: (9,5) Global 'y' is only used in the enclosing function; consider changing it to local. W003: (10,5) Global 'z' is only used in the enclosing function; consider changing it to local.