I've made a crouch script that's filtering enabled, but the animation keeps stopping
--LocalScript--
local uis = game:GetService("UserInputService")
local crouchevent = game.ReplicatedStorage.CrouchEvent
local crouchenabled = false
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.C then
if not crouchenabled then
crouchevent:FireServer(true)
elseif crouchenabled then
crouchevent:FireServer(false)
end
end
end)
--Script--
local crouchevent = game.ReplicatedStorage.CrouchEvent
crouchevent.OnServerEvent:Connect(function(player,enabled)
local humanoid = player.Character.Humanoid
local crouch = humanoid:LoadAnimation(script.Crouch)
if enabled then
humanoid.WalkSpeed = 10
humanoid.JumpPower = 25
crouch.Looped = true
crouch:Play()
crouch:AdjustSpeed(0)
humanoid.Running:Connect(function(speed)
if speed > 0 then
crouch:AdjustSpeed(1)
elseif speed == 0 then
crouch:AdjustSpeed(0)
end
end)
elseif not enabled then
crouch:Stop()
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
end
end)
I don't get any errors for some reason. Can anyone help?

3 comments
Player animations should be done on the client side (local scripts)
Please do player animations on a local script.
oh