Animations applied to HumanoidDescription do not work

Reproduction Steps
I am applying animations to HumanoidDescription, however, they do not work. The animations are made for an R15 rig, with highest priority set, so no reason not to work.

game.Players.PlayerAdded:Connect(function(player)
	local HumanoidDescription = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)
	
	-- Set to blocky
	HumanoidDescription.Head = 0
	HumanoidDescription.Torso = 0
	HumanoidDescription.LeftArm = 0
	HumanoidDescription.RightArm  = 0
	HumanoidDescription.LeftLeg = 0
	HumanoidDescription.RightLeg = 0
	
	HumanoidDescription.JumpAnimation = 8037790635
	HumanoidDescription.WalkAnimation = 8037792349
	
	if not player or not player.Parent then return end -- Player left
	
	player:LoadCharacterWithHumanoidDescription(HumanoidDescription)
end)

Expected Behavior
The applied animations to actually play, as they should and as the dev hub says they should

Actual Behavior
Nothing. They get set, but they do not play

Example here, just has default walk and jump animations, even though I have applied my custom animations.
ezgif.com-gif-maker (27)

Issue Area: Engine
Issue Type: Other
Impact: High
Frequency: Constantly
Date First Experienced: 2021-11-19 00:11:00 (+08:00)

1 Like

Yes

the asset you are trying to use is not in the correct format. to look at the format (for a run animation for example), download a catalog run animation using the command bar in Studio with the command e.g game:GetObjects("http://www.roblox.com/Asset/?id=619522386")[1].Parent = game.Workspace. Take a look at the downloaded asset (now in the workspace). In the downloaded asset, change the RunAnimation's AnimationId property to point to the asset id of your previously uploaded animation. Then upload the R15Anim folder to roblox. This will give you an asset id, and it’s this asset id that you set as the RunAnimation property of the HumanoidDescription.

Do similar for the WalkAnimation/JumpAnimation etc

2 Likes

I already tried this after seeing it from somewhere else,
image

and uploading the R15 folders to the website, and then using their model ids. These did not work.

These are my uploaded
https://www.roblox.com/library/8068711644/Jump-Anim
https://www.roblox.com/library/8068710120/Run-Anim

DevHub should also point this out, as it’s incredibly unclear, and I had to spend several hours sifting through forum posts to try finding out what I am supposed to do.

First, as a possible fix to your problem: in some cases, animation IDs stored as objects do not clone properly. If you are running your animation scripts for the player from the client (local scripts), check to see if these fields have disappeared while the game is playing. If they have, I have had luck using server scripts and/or using string values to store animation IDs.

Second, make sure the owner of the game is the person publishing the animation. No one but you can use animations you published in their game.

I do not use HumanoidDescription for my animations, so this is an alternate method, not a fix to your method. Also of note, I don’t use this method anymore either, as I have written my own scripts. I do not know if these methods have been made obsolete.:

You can grab a copy of the “Animate” script while your game is playing in studio, and save a copy. I do not recall if I had to save it in a different game or not. The point is, if you have this script on your character, another copy will not be generated. You can also add it to NPCs in a pinch (though I no longer recommend it). The children to this script serve the same purpose as your HumanoidDescription method. Put the animation ID into this Animation object, and the Animate script updates the default animations with it. A second option is to edit the script itself (which contains hard coded default animation IDs)

I don’t want to fork that script. If Roblox ever changes how animations work or what not, then I’d have to keep redoing this over and over (same reasons I never fork the chat scripts)

I also don’t like the 2k odd lines it has, I like to be pedantic about how many lines of code my game has. If HumanoidDescription has Animation properties, then they should work as intended

1 Like

this seems like maybe an ownership issue. As said above, make sure you made the animations and the place where you are using the animations. can you run the following in a Script (fill in the animModelId and animId at the top) and make sure you get no errors and the animid is correct, and you get the two assets parented to the workspace at the end

local animModelId = ????????
local animId = ????????
game.Players.CharacterAutoLoads = false
game.Players.PlayerAdded:Connect(function(player)
	player:LoadCharacterWithHumanoidDescription(Instance.new("HumanoidDescription"))
	
	local function LoadAsset(id)
		local model = nil
		local success, err = pcall(function()
			local containerModel = game:GetService("InsertService"):LoadAsset(id)
			model = containerModel:GetChildren()[1]
			model.Parent = nil
			containerModel:Destroy()
		end)			
		return model
	end
	
	local animFolder = LoadAsset(animModelId)
	if not animFolder then
		error("error: animFolder didn't download")
		return
	end
	animFolder:Clone().Parent = game.Workspace
	print("animation asset id", tostring(animFolder.run.RunAnim.AnimationId), "should be", tostring(animId))
	
	local anim = LoadAsset(animId)
	if not anim then
		error("error: anim didn't download")
		return
	end
	anim:Clone().Parent = game.Workspace
end)

No errors, get this printed. I used Jump animation, but changed the necessary points of the print for it to work as such.

animation asset id rbxassetid://8068756186 should be 8068756186  -  Server - Script:24

image

Is there any further information you can give me, or confirm that this is a bug and needs fixing. Really starting to become a pain as I cannot find any decent work around, and need to use my own animations as I am relying on keyframe stuff to do certain things

if the above worked, then, does the below work for you for changing the animations (fill in the correct animModelId):

local animModelId = ????????
game.Players.CharacterAutoLoads = false
game.Players.PlayerAdded:Connect(function(player)	
	player:LoadCharacterWithHumanoidDescription(Instance.new("HumanoidDescription"))
	
	local function LoadAsset(id)
		local model = nil
		local success, err = pcall(function()
			local containerModel = game:GetService("InsertService"):LoadAsset(id)
			model = containerModel:GetChildren()[1]
			model.Parent = nil
			containerModel:Destroy()
		end)			
		return model
	end
	
	local animFolder = LoadAsset(animModelId)
	if not animFolder then
		error("error: animFolder didn't download")
		return
	end
	
	player.Character.Animate.run.Parent = nil
	animFolder.run.Parent = player.Character.Animate
end)
1 Like

That seemed to work. Unsure what I need to do now to get it to work in my game tho

did the above get the correct animation to play for you?

Yes the above code got the correct animation to play for me.

Sorry for paraphrasing, but apparently a simple “yes” was considered spam and so I must now prolong my answer in order to not get marked as spam :slight_smile: Here is hoping that this is long enough to be not be deemed spam by moderation

2 Likes

Just now tested this is in my game, and it doesn’t work :confused:

So it works in an empty baseplate file, but not in an actual place. Place is uploaded by me