Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Very basic walking animation script by GnomeCode
- local character = script.Parent --Gets character
- local humanoid = character:WaitForChild("Humanoid") --Gets humanoid
- -- Remeber to select the animtion object and set the id to your own!
- local walkAnim = script:WaitForChild("Walk") --Gets the walk animation for later use.
- local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim) --Gets the variable for the animation using the animation instance's ID and the humanoid
- humanoid.Running:Connect(function(speed) --Creates a function once the character runs.
- if speed > 0 then --Plays the animation if the players speed is over 0.
- if not walkAnimTrack.IsPlaying then --Plays the track if it isn't playing already.
- walkAnimTrack:Play()
- end
- else --Stops the walk track if the player's speed is 0.
- if walkAnimTrack.IsPlaying then
- walkAnimTrack:Stop()
- end
- end
- end)
Add Comment
Please, Sign In to add comment