I’ve figured it out. For those who have the same problem as me, here’s the script.
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
local Character = Player.Character
local Humanoid = Character:FindFirstChild("Humanoid")
local Animation = Humanoid:LoadAnimation(script.Animation)
tool = script.Parent
tool.Equipped:Connect(function()
game.Players.LocalPlayer.Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid:// your running id"
Humanoid:ChangeState(Enum.HumanoidStateType.Landed)
end)
tool.Unequipped:Connect(function()
game.Players.LocalPlayer.Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid:// put your normal walking id" --default id
Humanoid:ChangeState(Enum.HumanoidStateType.Landed)
end)
Insert a Animation into the local script and put this into the tool.