Animation on client vs other people are different

I have a script that changes walking animations of the players depending on the value of a ObjectValue instance in the player, when playing the animations work fine and the correct animation plays when the objectValue has the specific value.

When doing teamTest and having my alt look at me, I am doing both the default running/walking animation and also the custom one I put in my script. Even when I am standing still, the animation still runs.

All animations are on the “movement” priority, everything looks fine on my client, just not for other players. I am not moving nor am i being moved by anything.

My screen:

My alt’s screen

Are you using client or server scripts to manage animations?

I have a serverscript sending a remotevent to a localscript, here is the code for both:

Localscript:

local ReplicatedStorage = game.ReplicatedStorage
local setRun = ReplicatedStorage.setRun
local player = game.Players.LocalPlayer
local function setRun1(anim)
	player.character.Animate.walk.WalkAnim.AnimationId = "rbxassetid://" .. anim
	player.character.Animate.run.RunAnim.AnimationId = "rbxassetid://" .. anim
end

setRun.OnClientEvent:Connect(setRun1)

Serverscript just calls the remoteevent with the player + animationID, basically below

policeRun = "115846971274296"
setRun = ReplicatedStorage.setRun

-- checks for player with specific objectValue
setRun:FireClient(player, policeRun)

Not sure if this helps, but it happens after the animation changes, sometimes it takes a few changes, sometimes it takes 1.

The most probable solution I can think of with the given information is with animators. Normally, the server will replicate all animations to clients when an animation is played on an animator. However, if the animator is made on the client, the server does not know it exists and will not replicate animations to the rest of the clients.

So if your script involves creating animator instances on a local scripts. Then this will most likely solve the problem. Otherwise, the best advice I can give is that the issue in question will probably be occurring in a client script given that the behavior is dependent on the player.

I see, just for clarification, is the potential solution to change the animation on a server script instead of a localscript?

Are you playing the animations on other peoples client because if you do that then what’s gonna happen is sense you have ownership to yourself the animation will auto replicate to the server when playing the animation to your own client. Therefor it will play the animation twice.

What you could do is make a Roblox rbx connection when an animation plays and stop it from playing again on your client or others.

Update: Thanks for your reply, I have updated the script to change animations with a server script, but the problem persists. I have observed 2 more things:

The running animation still plays when idle, and the animation played is the previous animation that hasnt been changed into.

e.g. I change from running animation A to running animation B, my alt sees me doing animation A even when standing still, I change from running animation B to running animation C, my alt sees me doing animation B even when standing still.

Just to note that everything works normal (idle animation plays when idle, running animation plays when moving, correct animation plays, etc) on my client screen, just not for other people. (have tested with multiple accounts at the same time)
There is no script that affects or changes animations in any way except the 2 scripts, and using search function, i can confirm these are the only 2 scripts doing anything regarding running animations.

1 Like

It’s recommend to play it on the client to reduce stress on the server.

1 Like

I am not sure how to do that, I am changing the animationID on the pre-existing “animate” script in every player, how would i apply your solution?

1 Like

Well the thing is why do you need to make a server script to make you run when you can do that on client?

Sense you do have ownership to your own root, the animation will auto replicate to the server.

I don’t, and that has what i have been doing, changing the animation on the client, but this bug is happening right now and I am not sure what is causing it.

What I mean is by loading the animation and playing it on the client without the server or any remotes. The only time you should do this is sync animations and such.

Thanks, I will try it and update the situation.

Hello, I am changing the animations only using the local script without any remoteevents or involvement with serverscripts, the error still persists.

I think it is another problem, since when the player isnt moving, the running animation shouldn’t be playing anyways. It is also strange that everything is working on the client, but looks different on the server, this is a first since normally it is the opposite.

There is also no anomalies on the animate script, the Id’s update as expected.

It seems that on the server, when the running animation plays, it dosent stop, and hence when i switch animations, both the old running animation and the new animation will play when i move, and only the old running animation plays when i dont move. this dosent happen on the client.

Also, it seems that randomly the Animate script is dissapearing. (Picture below is when the game has everything loaded and has ran for minutes)

I believe this is an error on Roblox’s part, could someone come take a look?