GetNameFromUserIdAsync work with negative userIds

Minor request: Make GetNameFromUserIdAsync work with negative IDs for use in Studio, so GetNameFromUserIdAsync(-1) would return “Player1”. This would make testing any features that use this function easier.

I found some code I wrote a year ago and it actually looks like it used to be like that based on the assumptions this code makes, but I can’t say with 100% certainty.

12 Likes

Would this work as a temporary fix, while this isn’t a feature?

function GetNameFromUserIdAsync(id)
    if id > 0 then
        return game.Players:GetNameFromUserIdAsync(id)
    elseif id < 0
        return "Player"..math.abs(id)
    end
end
2 Likes

That’s one way of handling this issue. I certainly hope that negative numbers become a feature soon, so you don’t have to do this.

I think you’re reading thunder’s script wrong, hes not actually running math.abs through the getusername function, hes just simulating it and returning a string which would work perfectly.

2 Likes

You right I did read it wrong :joy:

4 Likes