I have a function which creates characters using HumanoidDescription:
local function CreateCharacter(UserId, Slot)
if (CharactersLoaded[Slot] ~= nil) then
local Character = CharactersLoaded[Slot]
Character:Destroy()
end
local Character = DefaultRig:Clone()
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(UserId)
Character.Parent = CharactersFolder
Humanoid:ApplyDescription(HumanoidDescription)
HumanoidRootPart.CFrame = CharacterSpawns[Slot]
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
local Animator = Humanoid:FindFirstChild("Animator")
if (Animator == nil) then
Animator = Instance.new("Animator")
Animator.Parent = Humanoid
end
local IdleAnimation = Instance.new("Animation")
IdleAnimation.AnimationId = "rbxassetid://"..HumanoidDescription.IdleAnimation
local IdleTrack :AnimationTrack = Humanoid:LoadAnimation(IdleAnimation)
IdleTrack.Looped = true
IdleTrack:Play()
CharactersLoaded[Slot] = Character
end
Everything works besides the animation part; (Simplified function for readability)
local function CreateCharacter(UserId, Slot)
local Character = DefaultRig:Clone()
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(UserId) -- Should apply animations by default???
Humanoid:ApplyDescription(HumanoidDescription)
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:FindFirstChild("Animator") -- Attempt to load an animator and play animations that way
if (Animator == nil) then
Animator = Instance.new("Animator")
Animator.Parent = Humanoid
end
local IdleAnimation = Instance.new("Animation")
IdleAnimation.AnimationId = "rbxassetid://"..HumanoidDescription.IdleAnimation
local IdleTrack :AnimationTrack = Humanoid:LoadAnimation(IdleAnimation)
IdleTrack.Looped = true
IdleTrack:Play() -- Doesn't work
end
Characters load fine, they just don’t animate. No errors or anything:
This is a LocalScript, being viewed from client perspective.
Any ideas on how to troubleshoot? I tried checking different Ids, changing track properties, e.t.c.
Feel free to reply and ask for additional info. Any sort of help appreciated!