How can I find a players RigType from their Id to know which rig to import?

I’m trying to make an NPC that has a certain player Id in it and I’m trying to find out if there is a way to know what the players RigType is from only the Id so I can import the correct RigType because if I were to only have an R15 Rig and the player in the Id has an R6 RigType the animations won’t work correctly.

    local HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(95290160)
	
	local RigType = HumanoidDescription.RigType?

	if HumanoidDescription then
		if RigType.EnumType == Enum.RigType.R15 then
			R15Idle.Looped = true
			R15Idle:Play()
			warn("npc is r15")
		else
			R6Idle.Looped = true
			R6Idle:Play(R6Id)
			warn("npc is r6")
		end
	end
1 Like

You would use the Humanoid for this.

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local rigType = character.Humanoid.RigType
print("The player's RigType is:", rigType)

I’m not trying to get the RigType of a player inside the server but from a set Id in the model for a certain player, Sorry for the confusion.

You want to get the RigType of a player then if it is R6 local that players character with that rig?

I’m using the GetHumanoidDescriptionFromUserId(95290160) async to find information about a player from their player ID so I can make an NPC that looks like their avatar except I am unable to predict what the players RigType is and the issue is if I use an R15 rig from the start and the players RigType happens to be changed to R6 it will break.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)
	
	local AvatarEditorService = game:GetService("AvatarEditorService")

	-- Get the player whose appearance we want to copy
	local player = Players:GetPlayerByUserId(Player.UserId)

	-- Get the player's appearance as an R6 character
	local r6Description = Players:GetHumanoidDescriptionFromUserId(player.UserId, Enum.HumanoidRigType.R6)

	-- Get the player's appearance as an R15 character
	local r15Description = Players:GetHumanoidDescriptionFromUserId(player.UserId, Enum.HumanoidRigType.R15)

	-- Check if the player's appearance is the same in both cases
	local isR6 = (r6Description == r15Description)

	local npc = game.Workspace.Noob
	local humanoid = npc:WaitForChild("Humanoid")
	humanoid.Parent = npc

	if isR6 then
		humanoid:ApplyDescription(r6Description)
	else
		humanoid:ApplyDescription(r15Description)
	end

	
end)

Really all you need it

local r6Description = Players:GetHumanoidDescriptionFromUserId(95290160, Enum.HumanoidRigType.R6)

	-- Get the player's appearance as an R15 character
	local r15Description = Players:GetHumanoidDescriptionFromUserId(95290160, Enum.HumanoidRigType.R15)

	-- Check if the player's appearance is the same in both cases
	local isR6 = (r6Description == r15Description)

	local npc = game.Workspace.Noob
	local humanoid = npc:WaitForChild("Humanoid")
	humanoid.Parent = npc

	if isR6 then
		humanoid:ApplyDescription(r6Description)
	else
		humanoid:ApplyDescription(r15Description)
	end

The player I am trying to get the RigType from will not be in the server.
also in the script, I do not understand

 local isR6 = (r6Description == r15Description)

because in the parenthesis of

GetHumanoidDescriptionFromUserId(player.UserId, Enum.HumanoidRigType.R15)

you are setting what the RigType will be, it won’t be finding it but setting it

I was able to find an Async that can show me the RigType of a player through only their Id,

local CharacterInfo = game.Players:GetCharacterAppearanceInfoAsync(95290160)
	local HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(95290160)
	
	local RigType = CharacterInfo.playerAvatarType
	
	local NPC = game.Players:CreateHumanoidModelFromDescription(HumanoidDescription, RigType)

Thanks for the help though NDavis06

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