Why does my output error a working script?

I tried running “Players:GetHumanoidDescriptionFromUserId()” in a script, to update a NPC’s outfit to look just like mine, whenever I changed it. This is so I don’t need to keep on updating the NPC(s).

The error is that the outfit loads 100% of the time, though it prints an error message. This error message doesn’t come right when I load “play”; it comes after a few minutes to maybe an hour. It comes due to time I think.

I am assuming this is a bug because the error in the output says: “Players:GetHumanoidDescriptionFromUserId() failed because HTTP 500 (Internal Server Error)”

(note how it says “Internal Server Error”)

Here is the simple script in the Humanoid of the NPC:

local UserId = script.idNumberValue
local Humanoid = script.Parent

while wait() do
    local HumanoidDescription = game.Players:GetHumanoidDescriptionFromUserId(UserId.Value)
    Humanoid:ApplyDescription(HumanoidDescription)
end

In conclusion, any tips would work on telling me how to remove that from the output (using pcalls?) and I would like to know if it is a bug or something I have scripted incorrectly. Thanks for reading! :+1:

Error code 500 means something went wrong with the server. Remember that GetHumanoidDescriptionFromUserId makes a web request, and you’re trying to make 30 web requests a second. Are you sure you want to make that many requests? Why not tone it down a bit? To perhaps a request every 10 seconds perhaps?

1 Like

The NPC doesn’t have a player ID.

It does, I just put it into a IntValue’s Value so I am able to change the player I want directed as, quicker.

And I said the NPC dresses as the correct avatar, it is just the error message popping up, which is bothering me from other errors.

I think this works, I will have to try and wait until the error message pops up again, but for the considerable amount of time for me testing currently, it hasn’t! :slight_smile:

Thanks!