Hello there!
Today I’m trying something a little different.
My attempt here is to load a person’s avatar onto a blank rig—based on a randomly chosen player.
Here’s the code I’m using:
game.Players.PlayerAdded:Connect(function()
local Players = game.Players:GetPlayers()
local nplrs = #Players
local Randomplayer = nil
if nplrs > 0 then
Randomplayer = Players[math.random(1, nplrs)]
print(Randomplayer)
if Randomplayer ~= nil then
local id = game.Players:GetUserIdFromNameAsync(Randomplayer)
print(id)
local NewHumanoidDesc = game.Players:GetHumanoidDescriptionFromUserId(id)
workspace.R15.Humanoid:ApplyDescription(NewHumanoidDesc)
end
end
end)
It seems to work fine, except instead of getting the ID of the random player, it gets the ID of the user “Instance,” and applies the description of that person onto the rig, which I assume was put in purposely in case of something like this.
If anyone could help me understand what I’m doing wrong, that would be great, thank you!