I want to be able to change someones default avatar for the server without having to respawn them (basically using loadcharacter()), as im using a player added event to get the player in a server script. Downside is that putting loadcharacter into player added events means you just infinitely respawn the player. Why do i need this? Because for example putting starter character into the starter player service of the player will not be fast enough to do it before the character spawns, because i made the script check if a value i added into the player is true. Adding accesories/shirts wont be good as im attempting to copy a model thats in server storage thats suppose to be the character, into starter player. Thats also because the model has a different package, it has the robloxian 2.0, while some people may not already will have that package equipped.
I think :ApplyHumanoidDescription() could work, you should check it out
Ima search what thats about, seems helpful.
Looking at what it does on Humanoid | Roblox Creator Documentation, i dont really know how it works. Can you maybe explain how it does?
Straight from the wiki page you sent
This yield function makes the
character's
look match that of the passed inHumanoidDescription
. A copy of the passed look will then be cached in theHumanoid
as the current HumanoidDescription for the Humanoid.It allows you to quickly set and store a character’s appearance using a stored look without having to set each property every time.
Basically you either make a CharacterDescription, or pull one from a Player’s UserId and set it to the Humanoid. It allows you to, on the fly, change the look of one character, or many.
So would i do Humanoid:ApplyDescription(myCharacter)? I’m still abit confused.
local humanoidDescription = game:GetService("Players"):GetHumanoidDescriptionFromUserId(21467784)
workspace.KingJesseDev.Humanoid:ApplyHumanoidDescription(humanoidDescription)
Should set your character to look like mine.
Could i be able to use the character i have in server storage though? Ive seen one user that has pretty much the same character as the one i have, except with a slightly different shirt.
If the character has a Humanoid in it you can use this function on it’s Humanoid to get the HumanoidDescription it has on.
https://developer.roblox.com/en-us/api-reference/function/Humanoid/GetAppliedDescription
Humanoid:ApplyDescription()
holds a parameter, and that is the HumanoidDescription
instance, which models with Humanoids contain (specifically players). There are a few ways of achieving this:
- Humanoid:GetAppliedDescription() lets your get the model’s HumanoidDescription (pretty sure you’re looking for this one):
game.Players.LocalPlayer.Character.Humanoid:GetAppliedDescription()
- Players:GetHumanoidDescriptionFromUserId gets your the HumanoidDescription by UserId:
game.Players:GetHumanoidDescriptionFromUserId(1) --Roblox's appearance.
- Players:GetHumanoidDescriptionFromOutfitId() from the player’s OutfitId.
Yep, was looking for the first one. Thanks! Im testing this out, if it works ill mark it as solution.
Wait, how would i then use that description i got, onto my player so that i can use that character? im using Humanoid:GetAppliedDescription by the way.
local humanoid = game.Players.LocalPlayer.Character.Humanoid
local humanoidDescription = humanoid:GetAppliedDescription()
humanoid:ApplyDescription(humanoidDescription)
--applying their own appearance as an example.
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local starterplayer = game:GetService("StarterPlayer")
if Player.IsGuest.Value == true then
if Player.GuestOption.Value == 1 then
local humanoid = Character.Humanoid
local girlguest = game.ServerStorage.CoreStorage.BettyBloxxer:Clone()
local humanoiddescription = girlguest.Humanoid:GetAppliedDescription()
humanoid:ApplyDescription(humanoiddescription)
game.ServerScriptService.CustomCoreScripts.CharacterColors.Disabled = true
else
local humanoid = Character.Humanoid
local boyguest = game.ServerStorage.CoreStorage.BillyBloxxer:Clone()
local humanoiddescription = boyguest.Humanoid:GetAppliedDescription()
humanoid:ApplyDescription(humanoiddescription)
game.ServerScriptService.CustomCoreScripts.CharacterColors.Disabled = true
end
end
end)
end)
??? what is this
Just curious, if you’re just grabbing the HumanoidDescription, why do you need to Clone it and create a new CharacterModel for each character? You can just call the function on the original model.
Yeah i actually forgot, the reason why i was cloning is because i previously tried cloning into starter player before this topic. I’ll delete the cloning part since im not cloning into the starter player.
Anyway, how would i fix that error?
What line is the error coming from?
Line 9, appears “Humanoid::ApplyDescription() Data Model was not available” (i didnt put 2 colons btw)
Try again if you deleted the cloning line.