Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Get the humanoid and animator
- local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
- local animator = humanoid:WaitForChild("Animator")
- -- Create a new animation track
- local walkAnimation = Instance.new("Animation")
- walkAnimation.AnimationId = "rbxassetid://[insert animation ID here]"
- local walkAnimationTrack = animator:LoadAnimation(walkAnimation)
- -- Play the walk animation when the player starts walking
- humanoid.StateChanged:Connect(function(newState)
- if newState == Enum.HumanoidStateType.Walking then
- walkAnimationTrack:Play()
- elseif newState == Enum.HumanoidStateType.Standing then
- walkAnimationTrack:Stop()
- end
- end)
- --Put in StartercharacterScript Or StarterPlayerScript
Add Comment
Please, Sign In to add comment