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)
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)
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.
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)