I'm trying to make a crouching script that will play while the player is moving, and will pause while the player isn't. The animation is stuck being paused no matter what happens, and output shows no errors. Here's the script
Player = game.Players.LocalPlayer
repeat
wait()
until Player.Character
local Mouse = Player:GetMouse()
local char = game.Workspace[Player.Name]
local crouching = false
local Animation = script.Anim
local animtrack = char.Humanoid:LoadAnimation(Animation)
game:GetService("UserInputService").InputBegan:Connect(function(input,proc)
if proc == false and input.KeyCode == Enum.KeyCode.C and crouching == false then
crouching = true
animtrack:Play()
char.Humanoid.WalkSpeed = 10
if char.Humanoid.Running == false then
animtrack:AdjustSpeed(0)
elseif char.Humanoid.Running == true then
animtrack:AdjustSpeed(1)
end
else
if proc == false and input.KeyCode == Enum.KeyCode.C and crouching == true then
crouching = false
animtrack:Stop()
char.Humanoid.WalkSpeed = 16
end
end
end)
Thanks if you can help!

2 comments
KeyDown is deprecated and use local variables please. This code isn't very well indented either.
That's not the problem, and doesn't help me at all... Even if it is deprecated, that section works.