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
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 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
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)