Why is my character not crawling?
I can't make the avatar crawl. I have put this script in StarterPlayer.StarterCharacterScripts
and have an Animation inside of it. I am not having any warnings/errors. Here is my code
01 | local UserInput = game:GetService( "UserInputService" ) |
02 | local Player = game.Players.LocalPlayer |
03 | Player.CharacterAdded:wait() |
04 | local function WaitForChildOfClass(parent, class) |
05 | local child = parent:FindFirstChildOfClass(class) |
06 | while not child or child.ClassName ~ = class do |
07 | child = parent.ChildAdded:Wait() |
11 | local Animator = Player.Character:WaitForChildOfClass( "Humanoid" ):WaitForChild( "Animator" ) |
12 | local AnimationTrack = Animator:LoadAnimation(script.Animation) |
14 | UserInput.InputBegan:Connect( function (Input, GameProcessed) |
15 | if not GameProcessed and Input.UserInputType = = Enum.UserInputType.Keyboard and Input.KeyCode = = Enum.KeyCode.C then |
17 | Player.Character.Humanoid.WalkSpeed = CrawlSpeed |
20 | UserInput.InputEnded:Connect( function (Input, GameProcessed) |
21 | if not GameProcessed and Input.UserInputType = = Enum.UserInputType.Keyboard and Input.KeyCode = = Enum.KeyCode.C then |
22 | Player.Character.Humanoid.WalkSpeed = 16 |
Why is this not working? Any help would be greatly appreciated. Thanks!