Animation isnt loading on a specific character ( No Errors )

game.Players.PlayerAdded:Connect(function(plr)
	if plr.Name == "Username" or "Username" or "PutUsernameHere" then
		local Ani = Instance.new("Animation")
		Ani.AnimationId = "rbxassetid://11111111"

		local animator = Instance.new("Animator")
		animator.Parent = plr
		local animationload = animator:LoadAnimation(Ani)
		
		animationload:Play()		
	end
end)

I want the script to make it so, the animation only works for specific people, but I’m currently having issues, there are no errors can somebody help me out?

I dont know how to use animators but something like this should work lol.

game.Players.PlayerAdded:Connect(function(plr)
	if plr.Name == ("Username" or "Username" or "PutUsernameHere") then
		local Ani = Instance.new("Animation")
		Ani.AnimationId = "rbxassetid://id"

		local humanoid = plr.Character.Humanoid
		local animationload = humanoid:LoadAnimation(Ani)
		
		animationload:Play()		
	end
end)

I tested your theory, and it still has the same result. Still no errors btw.

Alright, so I changed it a bit and this should work since its working for me:

local playerTable = {
	490884950; --// The Players You Want! I suggest using their UserId so then if they change their Username it still works!
	132;
	123;
}

game:GetService("Players").PlayerAdded:Connect(function(player)
	local localUserId = player.UserId
	for _, userId in ipairs(playerTable) do
		if (localUserId == userId) then
			local character
			repeat
				character = player.Character
				wait()
			until character ~= nil
			
			local Ani = Instance.new("Animation")
			Ani.AnimationId = "rbxassetid://6389732606" --// Change the animation ID
			
			local humanoid = character:WaitForChild("Humanoid")
			local animationload = humanoid:LoadAnimation(Ani)
			animationload:Play()
		end
	end
end)

Where did you locate the script?

Animations should be handled on the client also please use the newest method to load the animation as LoadAnimation is deprecated and should not be used. Deprecating LoadAnimation on Humanoid and AnimationController

You want this in a server script in server script service.

Animations are not recommended to be played in the server and also it replicates to the server from client.

So… what do you suggest in the script and what should I do?

Use a localscript or fire a remote from the server to the client if you really need the server script… Actually because this is whitelisted, handle it from the server and fire the client and play the animation.

It really doesent matter, it works either way.

ill use a serverscript for now as i am too bothered to fire a remote in 31 C

It is recommended for optimization and smoothness of the animation. I also fixed another problem in Discord by changing a user’s script to a local.

That’s awesome, I’ll do remote events/client later on, at the moment it’d be a placeholder though…

Is the animation’s priority Action?

No It’s Idle, because it’s meant to be an idle.

In that case just use Roblox Animate script but then edit in your animation id. Then use my code to place that script in the player.

Change the script to:
Sorry for bad formatting, it glitched out. You can change the animation priority to Idle too if Action works.

local playerTable = {
	490884950,
	0, 
}

game:GetService("Players").PlayerAdded:Connect(function(player)
	local localUserId = player.UserId
	if table.find(playerTable,localUserId) then
		local character = player.Character or player.CharacterAdded:Wait()
		local Ani = Instance.new("Animation")
		Ani.AnimationId = "rbxassetid://6389732606" --// Change the animation ID

		local humanoid = character:WaitForChild("Humanoid")
		local animationload = humanoid:LoadAnimation(Ani)
                animationload.Priority = Enum.AnimationPriority.Action
		animationload:Play()
	end
end)

thats right, I forgot about table.find() nice.

Mhm, also the table was sort of incorrect.