Need help creating a r6 character from UserID

Hi,

I want to create a r6 character model only from the local players userid. I tried using getcharacterappearenceinfoasync but I’m not sure how to use it.

function Camera._createCharacter(self: ClassType) -- create fake character tbused
	local characterAppearance = Players:GetCharacterAppearanceInfoAsync(LocalPlayer.UserId)
	characterAppearance.Parent = game.Workspace
end

Players:GetCharacterAppearnceInfoAsync() tells you what the player has equipped for their avatar, but it’s not as intuitive to use for creating a Character model.


Instead, you could utilize Players:GetHumanoidDescriptionFromUserId() to create a HumanoidDescription based on that player’s avatar, and then use that in Players:CreateHumanoidModelFromDescription() to create the Character model.

  • Since a player might not have R15 for their default avatar, you can specify the R6 RigType when creating the Humanoid Model to ensure it spawns a Character with that RigType:

Example LocalScript Code

local Players = game:GetService("Players")
local player = Players.LocalPlayer

local function exampleFunction()
    -- Creates a HumanoidDescription based on the LocalPlayer's UserId
	local HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(player.UserId)
	if not HumanoidDescription then return end -- Makes sure it exists; if not, the function stops to prevent errors from occurring
	
    -- Creates a new Character model based on the HumanoidDescription.
    -- Enum.HumanoidRigType.R6 is specified to ensure it is an R6 Character model
	local characterModel = Players:CreateHumanoidModelFromDescription(HumanoidDescription, Enum.HumanoidRigType.R6)
	if not characterModel then return end -- Makes sure it exists; if not, the function stops to prevent errors from occurring
	
	characterModel.Parent = workspace -- Places the new Character into the Workspace
    -- characterModel:PivotTo() -- Optional; insert CFrame here to place it in a specific spot within the map
end
exampleFunction()

If you have any additional questions about this, feel free to ask :grin:

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