How can i have the game create a player's Humanoid model if their not in game?

Recently, I have been working on a Admin Panel of sorts and got to the idea of being able to create a player’s avatar through a gui. I have tried spawning a character model through humanoid Description and through a player’s UserID. Both have failed.

local script:

script.Parent.MouseButton1Down:Connect(function()
local target = script.Parent.Parent.Player.Text
script.Parent.Parent.LoadScript.LoadCharacter:FireServer(target)
end)

remote event script:

script.LoadCharacter.OnServerEvent:Connect(function(player, target)
local PlayerService = game:GetService("Players")
local TargetId = PlayerService:GetUserIdFromNameAsync(target)
print(TargetId)
local HumanoidDescription = PlayerService:GetHumanoidDescriptionFromUserId(TargetId)
print(HumanoidDescription)
PlayerService:CreateHumanoidModelFromDescription(HumanoidDescription)
end)

First off, load character is used to basically force respawn somebody so it is not able to be used in this way. Second, I have a leaderboard system that displays the highest players model in a throne. I use this function to first off get the players appearence.

	local charModel = game.Players:GetCharacterAppearanceAsync(playerId)

I then clone a pre made dummy thats in serverstorage into the workspace where I then loop through the model and put all the accesories and stuff from the character appearence model onto the dummy which I can then maniplute to sit in the throne.

Here is the full code with all of this togethor.


	local clone = game:GetService("ServerStorage"):WaitForChild("Dummy"):Clone()
	clone.Parent = workspace

	local charModel = game.Players:GetCharacterAppearanceAsync(playerId)

	for _,v in pairs(charModel:GetChildren()) do
		v.Parent = clone
	end

Once you have this I recommend just using viewport frames to add the players character into the UI. Dont forget to mark this as a solution if this helps :grin:

1 Like

Alright, I’ll try this out (30 chars)

1 Like

this didnt work, it only gave an error of “unable to cast string to int64” the same problem i had earlier

I would recommend using humanoid:ApplyDescription(desc), because :GetCharacterAppearanceAsync(playerId) sometimes misplaces hats.

However, I do agree with the cloning a dummy method.

local dummy = game.ServerStorage:WaitForChild("Dummy")

script.LoadCharacter.OnServerEvent:Connect(function(player, target)
    local clonedummy = dummy:Clone()
    clonedummy.Parent, clonedummy.Name = workspace, player.Name

    local desc = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)
    clonedummy.Humanoid:ApplyDescription(desc)
end)

that means your not passing a players id, that means your passing a string and not what it expects. You need to pass the Id and not the name or the player itself.

oh yeah you’re right sorry about that lemme try it again with the id

alright it worked I’ll mark yours as the solution and thank you guys for the help!

1 Like

Alright I just tried yours and yours works much better as his didnt load the character properly.

1 Like