Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my character not crawling?

Asked by 3 years ago

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

01local UserInput = game:GetService("UserInputService")
02local Player = game.Players.LocalPlayer
03Player.CharacterAdded:wait()
04local function WaitForChildOfClass(parent, class)
05    local child = parent:FindFirstChildOfClass(class)
06    while not child or child.ClassName ~= class do
07        child = parent.ChildAdded:Wait()
08    end
09    return child
10end
11local Animator = Player.Character:WaitForChildOfClass("Humanoid"):WaitForChild("Animator")
12local AnimationTrack = Animator:LoadAnimation(script.Animation)
13local CrawlSpeed = 8
14UserInput.InputBegan:Connect(function(Input, GameProcessed)
15    if not GameProcessed and Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode == Enum.KeyCode.C then
View all 25 lines...

Why is this not working? Any help would be greatly appreciated. Thanks!

Answer this question