|
| 20 Jul 2015 12:44 AM |
| Since data store onupdate isn't instant, is there another option that I can do that's instant? |
|
|
| Report Abuse |
|
|
gooey333
|
  |
| Joined: 24 Mar 2013 |
| Total Posts: 1208 |
|
|
| 20 Jul 2015 12:51 AM |
| The problem it isn't instant is because it takes time to get data from roblox about your datastore, so no |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2015 12:52 AM |
How about a while wait(1) do?
I can use getasync instead. |
|
|
| Report Abuse |
|
|
gooey333
|
  |
| Joined: 24 Mar 2013 |
| Total Posts: 1208 |
|
|
| 20 Jul 2015 12:54 AM |
| That would quickly disable your data stores and make it MUCH slower than it already is. What are you trying to accomplish using this? |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2015 12:55 AM |
Getting the player count of the servers of the places connected to my main place.
Trying to do a server list. |
|
|
| Report Abuse |
|
|
gooey333
|
  |
| Joined: 24 Mar 2013 |
| Total Posts: 1208 |
|
|
| 20 Jul 2015 12:57 AM |
| Well, I've attempted such things and they didn't work! So I used an alternative and decided to count the number of servers instead of players by keeping track of them with DataStores |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2015 12:58 AM |
| Wait, how would you get the player count? |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2015 12:59 AM |
| Right now im getting it by updating the data store for it whenever a player joins or leaves. |
|
|
| Report Abuse |
|
|
gooey333
|
  |
| Joined: 24 Mar 2013 |
| Total Posts: 1208 |
|
|
| 20 Jul 2015 12:59 AM |
| I'm not sure you can or how if you can. I know there is a way somewhere depending on how often you need to check. What are you checking for? |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2015 01:01 AM |
| Im checking for updating my server list at my main place. |
|
|
| Report Abuse |
|
|
gooey333
|
  |
| Joined: 24 Mar 2013 |
| Total Posts: 1208 |
|
|
| 20 Jul 2015 01:03 AM |
| Why not keep track of open servers instead of players? |
|
|
| Report Abuse |
|
|
| |
|
gooey333
|
  |
| Joined: 24 Mar 2013 |
| Total Posts: 1208 |
|
|
| 20 Jul 2015 01:11 AM |
Make a DataStore called 'Servers'
Put a script in each game that adds a value to Servers when it starts.
Then when it ends (use game.OnClose) do the opposite.
In your main place you can get 'Servers' to see how many servers are running.
May want to shutdown your game before implementing just in case. |
|
|
| Report Abuse |
|
|
gooey333
|
  |
| Joined: 24 Mar 2013 |
| Total Posts: 1208 |
|
|
| 20 Jul 2015 01:12 AM |
| DO NOT use loops when accessing DataStores! It will destroy or greatly lag your DataStores! |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2015 01:24 AM |
That's exactly how im keeping track of the servers. I record the player count to see if there's a space or not.
Is there another way? |
|
|
| Report Abuse |
|
|
gooey333
|
  |
| Joined: 24 Mar 2013 |
| Total Posts: 1208 |
|
|
| 20 Jul 2015 01:30 AM |
Yes, don't record the player account
Just put a server script in each of your places you want to count
Script:
DSS = game:GetService("DataStoreService") DS = DSS:GetDataStore("Servers")
DS:UpdateAsync("Running", function(old) return old + 1 end)
function game.OnClose() DS:UpdateAsync("Running", function(old) if old == 0 then return old end return old - 1 end) end
Now to check your running servers, just look for
DataStore("Servers") Async("Running") |
|
|
| Report Abuse |
|
|
| |
|