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: I could use some guidance

Previous Thread :: Next Thread 
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
23 Oct 2015 01:23 PM
At one point I am going to need to access random keys from a datastore. Can I have some guidance / advice on how to achieve so? It seems difficult, yet maybe not. I'm not really sure how to start off, though. Any tips would be wonderful!
Report Abuse
ChiefAlpha is not online. ChiefAlpha
Joined: 01 Oct 2015
Total Posts: 2014
23 Oct 2015 01:25 PM
Explain your scenario
Report Abuse
DermonDarble is not online. DermonDarble
Joined: 04 Jun 2015
Total Posts: 2576
23 Oct 2015 01:25 PM
I would suggest a hot bath and a turkey sandwich.

ADORABLE BISQUE
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
23 Oct 2015 01:31 PM
Well, if you ever played Clash of Clans or Boom Beach, they access other people's bases. All the bases are going to be saved in one Datastore. One base for each player (key). When I'm gonna create the attacking phase, I need to know how to get a random player (key) from said datastore. And thereby I can access that chosen key's data to load the base to attack. I don't know how to go about this, though. It makes great sense to me, but I don't know how to actually go about and do it.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
23 Oct 2015 01:40 PM
Make a key which has all the keys in it

I already told you this.
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
23 Oct 2015 01:42 PM
^ Don't know how. :/ /: ;/
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
23 Oct 2015 01:46 PM
You know how to make your keys when you save the player data
You know how to save data

What could be so hard? Do you understand how to use a table?
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
23 Oct 2015 01:51 PM
I'm more of a hands-on learner. If I see something I adapt to it. Can you show me a small example so I can get the point?
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
23 Oct 2015 01:53 PM
No.

If I show you how to fix it, you'll come back in a week with the same problem.
If I teach you how to fix it, you'll learn to use your brain before looking to us.
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
23 Oct 2015 02:00 PM
why do i even come here any more
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
23 Oct 2015 02:03 PM
You use the datastore and don't know how to do this... If the key's are userId's save them to another DS in a table and pick a random value.
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
23 Oct 2015 02:08 PM
?


for i,v in pairs(DataStore) do
print(v)
end


Like that? xD

Idk...
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
23 Oct 2015 02:16 PM
Aw, I don't think you can do that. It looks like you can, though, based on how DataStores look like on roblox' 'datastore structures'


:c
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
23 Oct 2015 02:19 PM
Use an ordered datastore, key can equal the player's key and the value could be their level or something you matchmaking is easier.
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
23 Oct 2015 02:21 PM
But I don't even know how to grab a random value from a datastore. Would that work with pairs or something..
It's hardd
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
23 Oct 2015 02:29 PM
Iterate through all the pages in the ordered store

Throw them in a table 'temp'

key = temp[math.random(1, #temp)
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
23 Oct 2015 03:01 PM
That does make sense! So, I'll use OrderedDataStores to save the bases. I just remembered the global leaderboard stuff.. Thanks, I'll check into this.
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
23 Oct 2015 03:42 PM
'Dictionary is not allowed in Datastore'

What do you propose I do now?
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
23 Oct 2015 04:23 PM
Save their base to a data store, note the key.

Using that key, save their level or something (must be an int) to the ordered data store.
Then when you iterate through all the pages of the datastore you can sort out people whose level are too high or low for matchmaking and do what I said previously to get a random player from that dataset.
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
23 Oct 2015 06:05 PM
Thanks, will do.
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