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 » Scripting Helpers
Home Search
 

Re: save userId to datastore

Previous Thread :: Next Thread 
MonsterSloth is not online. MonsterSloth
Joined: 21 Nov 2012
Total Posts: 131
31 Aug 2014 08:18 PM
how can i save the userId of the players that visit to datastore ?

local DataStore = game:GetService("DataStoreService")
local userIds = DataStore:GetDataStore("userIds")

game.Players.PlayerAdded:connect(function(newPlayer)
local id = newPlayer.userId
Usernames:SetAsync(id, newPlayer.Name)
end)

local pages = userIds:GetSortedAsync(false, 10)
local page = pages:GetCurrentPage()
for i, v in pairs(page) do
local userId =userIds:GetAsync(v.key)
print(userId )
end
Report Abuse
super10099 is not online. super10099
Joined: 30 Jan 2010
Total Posts: 1102
31 Aug 2014 08:20 PM
whats GetSortedAsync?
Report Abuse
MonsterSloth is not online. MonsterSloth
Joined: 21 Nov 2012
Total Posts: 131
31 Aug 2014 08:26 PM
pageSize,
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
31 Aug 2014 08:26 PM
It sorts the data
You use it for highscore leaderboards like that
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
31 Aug 2014 08:29 PM
I actually want a script to display all the players whom played my game
pm me if you get it working
Report Abuse
MonsterSloth is not online. MonsterSloth
Joined: 21 Nov 2012
Total Posts: 131
31 Aug 2014 08:37 PM
ok,that is part of what i am trying to do.
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
31 Aug 2014 09:00 PM
Doesnt this already save data
Report Abuse
MonsterSloth is not online. MonsterSloth
Joined: 21 Nov 2012
Total Posts: 131
31 Aug 2014 09:13 PM
the v.key returns a string"" and the userId is a number.that is part of my problem.
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
31 Aug 2014 09:21 PM
just save a store of names not userids
Report Abuse
Tortelloni is not online. Tortelloni
Joined: 09 May 2012
Total Posts: 4597
31 Aug 2014 09:25 PM
Use tonumber(userId) for the string userId problem.
Report Abuse
MonsterSloth is not online. MonsterSloth
Joined: 21 Nov 2012
Total Posts: 131
31 Aug 2014 09:29 PM
i need the id number so i will take a look at the tonumber. thanks
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
01 Sep 2014 12:06 AM
you never defined usernames
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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