Animations stopping/not playing when switching from client to server

So I’ve got some animations playing on the client with their weights being adjusted inside a renderstepped, when I first join everything works fine on the client.
Then I switch over to server and the animations are not playing (sometimes they might but it’s totally random), if I switch back to the client then one animation might also stop playing on the client.

Does anyone know why this happens?

Video:

Script:

local lookUp_Track = Instance.new("Animation")
lookUp_Track.AnimationId = "rbxassetid://15318076698"
local lookUp : AnimationTrack = Humanoid.Animator:LoadAnimation(lookUp_Track)

local lookDown_Track = Instance.new("Animation")
lookDown_Track.AnimationId = "rbxassetid://15318065340"
local lookDown : AnimationTrack = Humanoid.Animator:LoadAnimation(lookDown_Track)

lookUp:Play(0, 0.5)
lookDown:Play(0, 0.5)



RunService.RenderStepped:Connect(function(dt)
	
	local LookDirectionWeight = math.asin(Camera.CFrame.LookVector.y)
	
	
	print((math.clamp(LookDirectionWeight, -1, 1) + 1) / 2)
	print((math.clamp(LookDirectionWeight*(-1), -1, 1) + 1) / 2)
	
	
	lookUp:AdjustWeight((math.clamp(LookDirectionWeight, -1, 1) + 1) / 2)
	lookDown:AdjustWeight((math.clamp(LookDirectionWeight*(-1), -1, 1) + 1) / 2)
end)

The script type you’re using is wrong if you want to make it server sided. You’re supposed to use a “script” not a “local script” for global operations

Animations replicate from the client to the server. As mentioned sometimes it might play on the server, but it appears to be very random when it does and will break again if switching to client and then back to server.

have you tried a 2 player test?

What are you trying to accomplish if I may ask? Still unsure towards what you are really trying to achieve.

I’m trying to figure out why my animations, which I play on the client in a localscript inside StarterCharacterScripts, don’t replicate/play on the server properly.

What I think the issue could be is the :AdjustWeight(). I’m no expert but I am not sure towards if you can actually replicate it to the server with what you are trying to accomplish.

Or alternatively it could be also the fact that you start the animation instantly as the script loads in. Possible that the server cannot load it in time, but these are just my theories.

First reply: The adjustweight fully replicates along with the animation and as mentioned, the animations do work at times.
image

Second reply: I’ve thought about this too by putting a task.wait(2) in first line of the localscript. Sadly this didn’t change anything, I still find my animations not playing on the server.

Sorry that I couldn’t be a help. No clue myself, never actually done this before.

1 Like

Alright, I found the issue, apparently the “replicated” animations will stop if their weight reaches 0. A complaint was made all the way back in 2016.

Because you tried helping me so much, in case you ever want a short, smooth and performance-friendly head look up/down script, just send me a PM.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.