How to make animation play for everyone

so I have this system for crouching in a game I’m working on but the animation only works for client so other players cannot see the player doing the action, what could be the problem?
Thanks in advance.
Code below is in a local script inside StarterCharacterScripts:

local userinputservice = game:GetService("UserInputService")
local charecter = script.Parent
local humanoid = charecter:WaitForChild("Humanoid")
local crouchlanm = humanoid:LoadAnimation(script:WaitForChild("Crouch Walking"))
local isCrouching = false
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
userinputservice.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftControl then
		if not isCrouching then -- if not already crouched then do this
			
			isCrouching = true
			crouchlanm:Play(0.25)
			humanoid.WalkSpeed = 6
			humanoid.JumpPower = 0
			
		else -- if already crouching then do this
			
			isCrouching = false
			crouchlanm:Stop(0.25)
			humanoid.WalkSpeed = 12
			humanoid.JumpPower = 50
			
		end
	end
end)
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
humanoid.Running:Connect(function(speed)
	if isCrouching == true then
		if speed > 0 then -- if is moving then
			
			
			crouchlanm:AdjustSpeed(1)

		else
			
			crouchlanm:AdjustSpeed(0)

			end
		end
end)

Well I’m not sure if there is another way to solve this (there is another way but idk how) but I solved it by changing it to a normal script.

Use RemoteEvent | Roblox Creator Documentation to trigger server-sided script (Normal script, not LocalScript) and play animations.

1 Like

when i do that the animation takes a sec to play so when i move it takes a moment for the movement to become an animation

I don’t know this will works or not but you can try playing animations on client first, then send RemoteEvent

1 Like

I have it working on local rn but the thing is I have 2 animations, an idle crouch, and a moving crouch, the moving one works fine but the idle one just looks like your standing as it shows below

https://gyazo.com/fe2d065a8f77c9fbb790840b60019812

https://gyazo.com/9502b7df37239e7f7bce7601a7c65c8f

No need to repost, you could have just bumped your thread, just so you know.

sorry but this is a different question as the other one, i can delete if youd like.

edit: why cant i delete my old post

Just don’t worry about it. You’re fine.

1 Like

I fixed it, i just had to put an animator object inside the humanoid of the player, i did it from the workspace as i had a custom character but you can do it with a script too, this is my local script in StarterCharacterScripts:

local userinputservice = game:GetService("UserInputService")
local charecter = script.Parent
local humanoid = charecter:WaitForChild("Humanoid")
local crouchlanm = humanoid:LoadAnimation(script:WaitForChild("Crouch Walking"))
local StopAnimation = humanoid:LoadAnimation(script:WaitForChild("Crouch Walk Idle"))
local isCrouching = false
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
userinputservice.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftControl then
		if not isCrouching then -- if not already crouched then do this
			
			isCrouching = true
			StopAnimation:Play(0.25)
			humanoid.WalkSpeed = 6
			humanoid.JumpPower = 0
			
		else -- if already crouching then do this
			
			isCrouching = false
			crouchlanm:Stop(0.25)
			StopAnimation:Stop(0.25)
			humanoid.WalkSpeed = 12
			humanoid.JumpPower = 50
			
		end
	end
end)
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
humanoid.Running:Connect(function(speed)
	if isCrouching == true then
		if speed > 0 then -- if is moving then\
			
			StopAnimation:Stop(0.25)
			crouchlanm:Play(0.25)

		else -- if is no longer moving then
			
			crouchlanm:Stop(0.25)
			StopAnimation:Play(0.25)
			end
		end
end)