Check what player's default avatar is

So I have this thing that spawns in a random player, but I want it to spawn them with the avatar type they have equipped (r6 or r15), how would I check that?

1 Like

Is your goal to load a certain player’s avatar onto a rig? Sorry, I don’t understand very much.

What I’d do personally is get the children (GetChildren) of the player character that you want to check, and check if it has something like “UpperTorso”. R6 avatars consist of 6 limbs, and “UpperTorso” is not one of them, in contrast to R15.

1 Like

ohhh, i get it now!! @Cleetaros could also use a script sort of like this:

local function CheckRigType(Character)
  if Character:FindFirstChild("UpperTorso") then
    return "R15"
  else
    return "R6"
end
1 Like

yeah thats what I was going for, but I wanted to check for if say someone had an r15 avatar type, it would spawn an r15 rig and put their stuff on there, and vice versa with r6

1 Like

it’s actually probably easier if you guys see what i’m doing. Here, check this out, it should be clear.

1 Like

If i’m correct, the only way to make a rig other than building it yourself would be to use the Rig Builder under Avatar in studio and make the specific R6 and R15 ones, then use the :Clone() function to create a new one for each player.

While that could work, the built-in way of checking a Character’s RigType is through the Humanoid.RigType property (which is guaranteed to either be Enum.HumanoidRigType.R6 or Enum.HumanoidRigType.R15)

2 Likes

that wouldn’t really work, since i’m just loading them onto a base rig in replicated storage

Yeah this is the best way to go about it.

i’m so confused, how would this even work if i’m just loading the character’s appearance onto a rig

If you want to load their accessories/etc as well, you can :Clone() the rig and then use :GetAppliedDescription() to get the player’s avatar from their humanoid and do :ApplyDescription(their description) on the rig’s humanoid to load their appearance. Although, that would be kind of redundant since Roblox already does that. Maybe I’m misunderstanding.

By loading it onto the rig, do you mean loading it onto a separate rig or replacing the player’s avatar with the new rig?

Oh I’m aware; I was just providing clarification for what they suggested since there was a better way to go about checking for an existing Character’s RigType.


As far as your use case goes, you may be able to use Players:GetHumanoidDescriptionFromUserId() on the UserId of the random player that you want to spawn in, then call Players:CreateHumanoidModelFromDescription() on it in order to create a Character model that should respect the RigType that the player is using for their avatar (I haven’t tested it, but I imagine it would respect the RigType?)

Edit: Ah, just realized that one of the arguments for Players:CreateHumanoidModelFromDescription() requires you to specify the RigType, so that may not work for figuring out what it is in the first place… Will do some more research to see if I can figure something out :slight_smile:

1 Like

I duplicate a rig from ReplicatedStorage and this is a script inside it




	local ChoosenID = math.random(1, 1300000000)
	local Name = game.Players:GetNameFromUserIdAsync(ChoosenID)
	local Description = game.Players:GetHumanoidDescriptionFromUserId(ChoosenID)

	script.Parent:FindFirstChildOfClass("Humanoid"):ApplyDescription(Description)
	script.Parent:FindFirstChildOfClass("Humanoid").DisplayName = Name

1 Like

Okay, I think that should work. Playtest it and see what happens! Although, you should probably check to make sure that the player does exist, I’m not sure how you could do it but one way might be to check what the Description returns, perhaps it will return nil in that case.

Ahhh, I found something that could work!

Players:CreateHumanoidModelFromUserId()

Returns a character Model set-up with everything equipped to match the avatar of the user specified by the passed in userId. This includes whether that character is currently R6 or R15.

1 Like

Yeah I think this is the one, thanks

2 Likes

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