|
| 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 |
|
|
| |
|
| |
|
|
| 31 Aug 2014 08:26 PM |
It sorts the data You use it for highscore leaderboards like that |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 31 Aug 2014 08:37 PM |
| ok,that is part of what i am trying to do. |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2014 09:00 PM |
| Doesnt this already save data |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 31 Aug 2014 09:21 PM |
| just save a store of names not userids |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2014 09:25 PM |
| Use tonumber(userId) for the string userId problem. |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2014 09:29 PM |
| i need the id number so i will take a look at the tonumber. thanks |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2014 12:06 AM |
| you never defined usernames |
|
|
| Report Abuse |
|
|