I was trying to make a game where if you press "C", you will crouch. I have the script, and here it is.(I also put an animation into the local script and put in an animation ID I made)
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Animation = script:WaitForChild("Animation")
local Track = Humanoid:LoadAnimation(Animation)
Track.Looped = true
Track.Priority = Enum.AnimationPriority.Action
local function CheckKeyDown(Key)
if Key.KeyCode == Enum.KeyCode.C then
Track:Play()
Humanoid.WalkSpeed = 8
end
end
local function CheckKeyUp(Key)
if Key.KeyCode == Enum.KeyCode.C then
Track:Stop()
Humanoid.WalkSpeed = 16
end
end
UserInputService.InputBegan:Connect(CheckKeyDown)
UserInputService.InputEnded:Connect(CheckKeyUp)
Is there something I can add to make it work in the server? Thanks.

1 comment
If you set an animation to loop on the client, it won't loop on the server. Why not edit your animation to be looped by default and re-export it?