Animation script bug?

This is a local script.

This script works perfectly fine on one client, but when I test multiple, it doesn’t work on only the second client. Any ideas as to why?

local player = game.Players.LocalPlayer

local seatAnim = Instance.new("Animation")
seatAnim.Name = "SittingAnim"
seatAnim.AnimationId = "http://www.roblox.com/asset/id?=10558874416"

local loadSeatAnim = player.Character.Humanoid.Animator:LoadAnimation(seatAnim)

player.Character.Humanoid.StateChanged:Connect(function(old, new)
	if new == Enum.HumanoidStateType.Seated then
		loadSeatAnim:Play()
	elseif new ~= Enum.HumanoidStateType.Seated then
		loadSeatAnim:Stop()
	end
end)

That’s false, you can load and play animations even on the Client, the possibility of it is maybe something to do with the character, or when they load.

I’d reckon,

If you’re loading an animation on a player then it’s best to do it on the client.

If you’re doing it for a npc then it must be loaded on the server…

problem is, the animation is called via function, specifically when a humanoid state is changed to Seated.

that way, the character has ample time to load properly.

i’m quite stumped lol

Hm that is indeed interesting, I’m unsure, because far as I can tell you’re trying to load an animation into the Humanoid of the Client, and which is perfectly fine, nothing seems wrong far as I see it. Hm, however try loading it from the humanoid instead of the Animator, see if that does anything.

i guess you could try loading it on the server. i mean what harm can it do

i’ll give that a shot. not sure why roblox deprecated that method anyway…

image
nope, same result.

My initial thought would be to check animation priorities.

Try creating a new animation with the “Action” priority and see if that plays properly for each client?

i made sure they had action priority when making them initially.

Remember, it only works on one client, not the other.

however, it could just be a weird studio issue. i wonder if it works outside of studio…

did u check to is priority set correctly(nothing seems wrong with the code but i might be wrong)

also animations do work on all clients if they are fired onto a client which is how exploiters can have any animation they want and anyone can see

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

local seatAnim = Instance.new("Animation")
seatAnim.Name = "SittingAnim"
seatAnim.AnimationId = "http://www.roblox.com/asset/id?=10558874416"
local loadSeatAnim = animator:LoadAnimation(seatAnim)

humanoid.StateChanged:Connect(function(old, new)
	if new == Enum.HumanoidStateType.Seated then
		loadSeatAnim:Play()
	elseif new ~= Enum.HumanoidStateType.Seated then
		loadSeatAnim:Stop()
	end
end)

‘StarterCharacterScripts’ container.

i’ll give it a try and let the thread know about any issues.

yeah, still doesn’t work.

focused client:

unfocused client:
image

i wonder if it’s just a studio issue since the client that was focused worked while the unfocused client doesn’t work.
if that’s the case, then i shouldn’t need to worry, since every game client will be focused.

Strange, might be an issue concerning animation ownership and/or animation priority.