One downside of the current documentation, is that it offers very little insight over properly handling exceptions in the API. What happens when
Players:GetHumanoidDescriptionFromUserId fails to retrieve the HumanoidDescription data? Does it throw an error, or does it simply return a blank HumanoidDescription Instance? This seems like vital information to know, if anyone’s expected handle these edgecases correctly.
'Anyone know a thing or two about how to approach this?
I did some basic testing, and found that it will error, stopping the execution of the script.
If the UserId inputted belongs to a nonexistant user or a banned account, t hen it will error with “Players:GetHumanoidDescriptionFromUserId() failed because HTTP 400 (Bad Request)”.
If the UserId is less than or equal to 0 (e.g. 0, -1, -2) then it will error with
“Players:GetHumanoidDescriptionFromUserId() got invalid userId”
In both cases the code fails to continue execution. I would advice that you treat any other issues related to it as a execution stopping error too, so use a pcall() and other methods to ensure that the code runs without further issues.
Yeah, I’d figure that’s probably the safest approach. I’ll mark this as the solution, but if anyone has more technical details to add before the window closes, that’d also be much appreciated. Do you know if there’s any sort of time-out mechanism for Ids that are valid, but for whatever reason simply can’t be retrieved at that time?
The function can yield for valid user IDs, will time out the script. But definitely put it in a pcall, since guests have negative user IDs.
since guests have negative user IDs.
Guests haven’t been around since 2017.
All UserIds that will be encountered in Roblox will have positive IDs.
The last time I’ve seen a guest was in 2020. Also, guests are still a thing in the test server.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.