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
local UserInput = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
Player.CharacterAdded:wait()
local function WaitForChildOfClass(parent, class)
local child = parent:FindFirstChildOfClass(class)
while not child or child.ClassName ~= class do
child = parent.ChildAdded:Wait()
end
return child
end
local Animator = Player.Character:WaitForChildOfClass("Humanoid"):WaitForChild("Animator")
local AnimationTrack = Animator:LoadAnimation(script.Animation)
local CrawlSpeed = 8
UserInput.InputBegan:Connect(function(Input, GameProcessed)
if not GameProcessed and Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode == Enum.KeyCode.C then
AnimationTrack:Play()
Player.Character.Humanoid.WalkSpeed = CrawlSpeed
end
end)
UserInput.InputEnded:Connect(function(Input, GameProcessed)
if not GameProcessed and Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode == Enum.KeyCode.C then
Player.Character.Humanoid.WalkSpeed = 16
AnimationTrack:Stop()
end
end)
Why is this not working? Any help would be greatly appreciated. Thanks!
