Script editor incorrectly reports GetHumanoidDescriptionFromUserIdAsync expects User instead of number

The Luau type checker in Roblox Studio reports a type error when passing Player.UserId to Players:GetHumanoidDescriptionFromUserIdAsync() on strict mode, despite the code working correctly at runtime.

The error shown is:
“Type Error: Expected this to be ‘User’, but got ‘number’”

According to the Script Editor’s type information, the method signature appears to be:
GetHumanoidDescriptionFromUserIdAsync(userId: User): HumanoidDescription

However, Player.UserId is typed as a number, and passing it to this function successfully works both during Studio play sessions and in published experiences.

System Information:
Roblox Studio version: 0.729.0.7290838 (64bit)
Operating System: Windows 11 Pro (64bit)


HumanoidDescriptionBug.rbxl (68.5 KB)

Expected behavior

The function should accept Player.UserId without a type error and its method signature should be:
GetHumanoidDescriptionFromUserIdAsync(userId: number): HumanoidDescription

1 Like

If this is to be changed to Player.User then either

  • A new function should made for User since this function’s name is literally about UserId
  • It could be overloaded to support Player.User but UserId is kept as the primary overload since again, this function’s name is literally about UserId
1 Like

mine works just fine I dont know whats wrong with yours

It’s not about working, mine works fine as well. It’s just that it makes strict mode complain since the functions parameter requires a User object and a user id is well a number.

It doesnt complain about anything on my side It doesnt throw any warnings infact it even works with User aswell
there is no type errors either when using User or UserID

Are you using strict mode? If not then yeah it wouldn’t warn or error since well it’s not forcing type compliance.

No I dont use strict mode I prefer my code to be simple