generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: username from userid

Previous Thread :: Next Thread 
SkyDoesMinecraft is not online. SkyDoesMinecraft
Joined: 15 Jul 2012
Total Posts: 656
07 Apr 2016 11:32 PM
first off i wanna say that i know im probably going to get this function

function id(num)
if type(num) ~= "number" then
return
end
local sets = game:GetService("InsertService"):GetUserSets(num)
for k, v in next, sets do
if v.Name == "My Models" then
return v.CreatorName
end
end
end

or an httpservice thing. but i cannot use either in this situation
my reasons being a) i don't like relying on http requests (even though the function above counts as an http request oh well) and b) this function has an odd error on some users that are actually playing my game and it is causing issues

a prime example would be:

errors: print(id(8033963))
works: print(id(22753))

is there ANY other way to do this? or at least a way to "fix" this function?
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
07 Apr 2016 11:34 PM
function getname()
local player = game.Players:GetPlayerByUserId(28354663)
return player
end

local name = getname()
print(name)





Report Abuse
SkyDoesMinecraft is not online. SkyDoesMinecraft
Joined: 15 Jul 2012
Total Posts: 656
07 Apr 2016 11:38 PM
the problem here is that im using this for when the player isn't in the game most of the time. i have a leaderboard that updates by userid and then displays the actual username on the leaderboard using that id function
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
07 Apr 2016 11:39 PM
Pretty sure it works with players who aren't in-game.

"leaderboard that updates by userid"

Just use the id here in the code I gave you.



Report Abuse
SkyDoesMinecraft is not online. SkyDoesMinecraft
Joined: 15 Jul 2012
Total Posts: 656
07 Apr 2016 11:42 PM
returns nil
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
07 Apr 2016 11:42 PM
Ah, I see what you mean now just tested it use this function off game.Players instead:

function getname()
local player = game.Players:GetNameFromUserIdAsync(35485797)
return player
end

local name = getname()
print(name)



Report Abuse
SkyDoesMinecraft is not online. SkyDoesMinecraft
Joined: 15 Jul 2012
Total Posts: 656
07 Apr 2016 11:43 PM
this one works, thank you lol
Report Abuse
RoQuick is not online. RoQuick
Joined: 12 May 2013
Total Posts: 595
07 Apr 2016 11:45 PM
lol
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image