Long story short, I don't want this to pop up:
21:45:04.347 - Players:GetNameFromUserId() failed because HTTP 400 (HTTP/1.1 400 Invalid userId)
Here's what I have in the script:
function dostuff(task) local name = game:GetService("Players"):GetNameFromUserIdAsync(task) print(name) end
I tried pcalling, but that doesn't give me any names:
function dostuff(task) local good_to_go, name = pcall(function() game:GetService("Players"):GetNameFromUserIdAsync(task) end) if good_to_go then print(name) end end
I don't know how to get around this. Any help?
function dostuff(task) local good_to_go, name = pcall(function() game:GetService("Players"):GetNameFromUserIdAsync(tonumber(task)) end) if good_to_go then print(name) end end
Well, there's a numbervalue, and an Intvalue. task is a numbervalue, and userIDs are a intvalue. try using tonumber to solve this problem/