Animations Do Not Play For Other Players

Hello people, so I’m new to the forum so I really don’t know if this the right category, but I really need some help here.
So, regarding in-game gameplay, scripts, and animations, the animations do not seem to play for other players. At the moment, my script works perfectly well, and it does indeed play the animation, but the thing is, it does not play for other players. In Roblox Studio the script also works perfectly well and smoothly as well as in game. But for some reason when you play the game with other players, the animations do not show for mine or the other player’s screen.
Note that I have a Local Script inserted into the rig, and it does work.
I’ve tried changing “local” to “script.”, I’ve tried moving the root part to other parts of the body, and I’ve tried rewriting the entire script. I thought of reuploading the animations to ROBLOX, but it still seems to yield the same results. This also gives the same result if you play with more than 2 players, and it still shows the same issue for all the players.

This is a script I put into a custom rig.
The script I used is provided here:

local animation = Instance.new(“Animation”)

local character = Player
local humanoid = character.Humanoid

humanoid.Running:connect(function(state)
if state > 3 then
if CurrentState ~= “Running” then
CurrentState = “Running”

		if animations[1] ~= "" then
			animation.AnimationId = "http://www.roblox.com/Asset?ID=04540187205"
			playAnimation(character,animation)
		end
	end
else
	if CurrentState ~= "Idle" then
		CurrentState = "Idle"
		
		if animations[2] ~= "" then
			local ActiveTracks = humanoid:GetPlayingAnimationTracks()

for _,v in pairs(ActiveTracks) do
v:Stop()
end
animation.AnimationId = “http://www.roblox.com/Asset?ID=04540189200
playAnimation(character,animation)
end
end
end
end)

Sorry if this is a bit lengthy.
Thanks for reading.

For future reference, please put everything into a codeblock and indent it properly for other people to read it efficiently.

local animation = Instance.new(“Animation”)

local character = Player
local humanoid = character.Humanoid

humanoid.Running:connect(function(state)
	if state > 3 then
		if CurrentState ~= “Running” then
			CurrentState = “Running”
			if animations[1] ~= "" then
				animation.AnimationId = "http://www.roblox.com/Asset?ID=04540187205"
				playAnimation(character,animation)
			end
		end
	else
		if CurrentState ~= "Idle" then
			CurrentState = "Idle"
			if animations[2] ~= "" then
				local ActiveTracks = humanoid:GetPlayingAnimationTracks()
				for _,v in pairs(ActiveTracks) do
					v:Stop()
				end
				animation.AnimationId = “http://www.roblox.com/Asset?ID=04540189200”
				playAnimation(character,animation)
			end
		end
	end
end)

With that said, I believe there are a few variables that need to be defined for us to help you. Please give us what you define animations and playAnimation.

1 Like

What do you mean by this part?

What he means is that you should post your code used in the animations and playAnimation function

Hes asking to see what those variables are.

Local anim = animator-- for example.

There are two things that come to mind for me.
Either the animation hasn’t been approved by mods, or, the animation is client side only. You’ll have to load the animation on the server for it to tell all the other clients what is happening.

How would I go about doing that?

What kind of script is your code running in now?

It’s running in a Local Script.

So that’s the problem I’d be willing to bet.

Where is the script placed before runtime?

The script is inserted into the model.

So simply copy and past your code into a server script (script) and remove the local script.

Past that code ×D

So put it into a normal script?

Well, it’s a Server script. But yes.

Alright, I’ll see if that fixes the issue.

This is assuming that the model is somewhere in the workspace by default, and not cloned by a local script.

Oh, no, the model is in the Replicated Storage.

It appears that the issue has been resolved, but the script runs slower. Nonetheless, thanks for the help. c:

1 Like