Can i use CreateHumanoidModelFromUserId() to create a R6 Model?

I want to load a Players Character on the CLIENT side with the avatar type R6. This is what i currently tried but it didnt work because the accessories didnt display…

local HumanoidModel = Players:CreateHumanoidModelFromUserId(RandomId)
				Rig.Name = UserService:GetUserInfosByUserIdsAsync({RandomId})[1].DisplayName
				
				for _, Child in pairs(Rig:GetChildren()) do
					if Child:IsA("Accessory") or Child:IsA("Shirt") or Child:IsA("ShirtGraphic") or Child:IsA("Pants") or Child:IsA("BodyColors") then
						Child:Destroy()
					end
				end
				for _, Child in pairs(HumanoidModel:GetChildren()) do
					if Child:IsA("Accessory") or Child:IsA("Shirt") or Child:IsA("ShirtGraphic") or Child:IsA("Pants") or Child:IsA("BodyColors") then
						Child.Parent = Rig
					end
				end
				HumanoidModel:Destroy()

Thanks for your Help :smiley:

Players:CreateHumanoidModelFromUserId() creates a character based on what the user has equipped (R6 or R15) so it wouldn’t guarantee to spawn in an R6 Character.

Instead of that, you could use Players:GetHumanoidDescriptionFromUserId() to create a HumanoidDescription of their Character, and then use Players:CreateHumanoidModelFromDescription() on that, specifying the R6 RigType so it’ll load an R6 Character even if they have R15 equipped.

Example

local Players = game:GetService("Players")

local RandomId = 1 -- placeholder

local HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(RandomId)
local HumanoidModel = Players:CreateHumanoidModelFromDescription(HumanoidDescription, Enum.HumanoidRigType.R6)

-- Continue with other stuff from the original code

HumanoidModel.Parent = workspace

Edit: oh and I missed this part until re-reading the post after completing this

The accessories wouldn’t appear because the code deletes any Accessories within the first loop, so checking if Child:IsA("Accessory") would not be needed if you wanted the Character to keep their accessories once it has been spawned in.

2 Likes

That worked perfectly fine! Thank you!!

1 Like

Some R15-only assets (like layered clothing or R15-only animations) may not work or may be ignored. Keep this in mind

1 Like

Alright. But i alrady expected to be like this. I mean in R6 games thes will be ignored awayways

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.