local tool = script.Parent
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=5215451472" --replace with id
local anim2 = Instance.new("Animation")
anim2.AnimationId = "http://www.roblox.com/Asset?ID=5215438040"
local anim3 = Instance.new("Animation")
anim3.AnimationId = "http://www.roblox.com/Asset?ID=5215447345"
local anim4 = Instance.new("Animation")
anim4.AnimationId = "http://www.roblox.com/Asset?ID=5215431829"
local derbis = game:GetService("Debris")
local Idletrack
local track2
local runningTrack
local Running = false
local equipped = false
local attacktrack2
local Cooldown = false
tool.Equipped:Connect(function()
equipped = true
local Char = script.Parent.Parent
if equipped == true then
Idletrack = script.Parent.Parent.Humanoid:LoadAnimation(anim)
Idletrack.Priority = Enum.AnimationPriority.Idle
Idletrack.Looped = true
Idletrack:Play()
end
if equipped == true then
runningTrack = script.Parent.Parent.Humanoid:LoadAnimation(anim3)
runningTrack.Priority = Enum.AnimationPriority.Movement
script.Parent.Parent.Humanoid.Running:Connect(function(Speed)
if not Running and Speed > 0.50 then
Running = true
runningTrack:Play()
elseif Running and Speed <= 0.50 then
Running = false
runningTrack:Stop()
Idletrack:Play()
end
end)
end
end)
tool.Unequipped:Connect(function()
equipped = false
if Idletrack.IsPlaying or runningTrack.IsPlaying or track2.IsPlaying then
Idletrack:Stop()
runningTrack:Stop()
track2:Stop()
end
end)
Pretty self-explanatory, but here is a gif:
https://gyazo.com/f68061712971f98905cbaf5d8135c826