There are no errors, and this is on the server. The animation simply doesn’t play.
Code:
game.ReplicatedStorage.Emote.OnServerEvent:Connect(function(player, animid, looped)
local humanoid = player.Character.Humanoid
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://" .. animid
if humanoid:IsA("Humanoid") then
print("Received hum")
local animator = humanoid:WaitForChild("Animator")
if animator then
print("Received animator")
local animationTrack = animator:LoadAnimation(Anim)
animationTrack.Looped = looped
animationTrack:Play()
return animationTrack
end
end
end)
So I can see in your output that it is inside a script, so if this is an animation your trying to play on yourself it should be placed inside a local script`
Ok, there’s another problem. I am running this on the client but it still will not play the animation. Code:
-- yes i do call the function, and ID and looped are valid
local function playAnim(ID, looped)
local character = game.Players.LocalPlayer.Character
if not character or not character.Parent then
print("not char")
character = game.Players.LocalPlayer.CharacterAdded:Wait()
end
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://" .. ID
local AnimationTrack = animator:LoadAnimation(Animation)
AnimationTrack.Looped = looped
if AnimationTrack then
print("got anim")
AnimationTrack:Play()
end
end
Did you create the animation yourself? Or did someone else make it for you, like in Team Create, and their the owner while you’re trying to script it? The animations only play for the owner of the place (Inside studio) if the animations are owned by the place owner.
I would probably make a quick animation, something like just moving the arm up and down, then export that and use that ID to see if there is any difference
I’ve tried to loading an animation using “rbxassetid://” sometimes and it hasnt worked.
ALSO heres a few modifcations I’ve made which i’m not sure if it will work but you can try.
game.ReplicatedStorage.Emote.OnServerEvent:Connect(function(player, animid, looped)
local humanoid = player.Character.Humanoid
local Anim = Instance.new("Animation")
Anim.AnimationId = "http://www.roblox.com/Asset?ID=" .. animid
if humanoid:IsA("Humanoid") then
local animator = humanoid:WaitForChild("Animator")
if animator then
local animationTrack = humanoid:LoadAnimation(Anim)
animationTrack.Looped = looped
animationTrack:Play()
return animationTrack
end
end
end)