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)
The function should accept Player.UserId without a type error and its method signature should be:
GetHumanoidDescriptionFromUserIdAsync(userId: number): HumanoidDescription
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