Cronaldo_960

Roblox studio script Animation Walk

Sep 12th, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.74 KB | Source Code | 0 0
  1. -- Get the humanoid and animator
  2. local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
  3. local animator = humanoid:WaitForChild("Animator")
  4.  
  5. -- Create a new animation track
  6. local walkAnimation = Instance.new("Animation")
  7. walkAnimation.AnimationId = "rbxassetid://[insert animation ID here]"
  8.  
  9. local walkAnimationTrack = animator:LoadAnimation(walkAnimation)
  10.  
  11. -- Play the walk animation when the player starts walking
  12. humanoid.StateChanged:Connect(function(newState)
  13.     if newState == Enum.HumanoidStateType.Walking then
  14.         walkAnimationTrack:Play()
  15.     elseif newState == Enum.HumanoidStateType.Standing then
  16.         walkAnimationTrack:Stop()
  17.     end
  18. end)
  19. --Put in StartercharacterScript Or StarterPlayerScript
Add Comment
Please, Sign In to add comment