When I was trying to find solutions for this problem nothing was showing up so it took me a very long time to come up with a solution on my lonesome, mainly becuase I’m not a very good scripter. So I decide To make a tutorial of my own. Mind you I am VERY new to scripting so the script my be buggy.
I am open to critisism .
local humanoid = nil
local character = nil
local player = nil
local humanoidrootPart = nil
script.Parent.Equipped:Connect(function()
humanoid = script.Parent.Parent.Humanoid
player = game.Players.LocalPlayer
character = player.Character or player.CharacterAdded:Wait()
forwardAnim = character:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("ForwardAnim"))
idleAnim = character:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("IdleAnim"))
humanoidrootPart = script.Parent.Parent.HumanoidRootPart
idleAnim:Play()
humanoid.Running:Connect(function(speed)
if speed > 0.01 then
forwardAnim:Play()
else
forwardAnim:Stop()
end
end)
end)
script.Parent.Unequipped:Connect(function()
idleAnim:Stop()
forwardAnim:Stop()
end)
put this in a local script in your tool and put you animations inside your script.