Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make a global 'broad' datastore?

I was wondering if there was a way I could make a datastore, but it isn't parented to any player. For example I want to make a datastore of the total amount of sales in all the players in my game, online or not. So when I player sells something a value gets added to that 'global' datastore, and that datastore's value holds all sales of every player. It's a bit hard to explain so if you want more information just ask me! Thanks!

The number of the datastore's value could be like 1029374, that means each one if those numbers had been added every time a player sold something.

1 answer

The only reason that datastores are linked to players is because the key of the datastore is set to the player's UserId. You can make this key whatever you want though (e.g. "Sales"), and it will automatically be accessible from any server (you just have to make sure the number of requests are within the limits). If you are just storing a single number that counts up, it's probably best to use IncrementAsync. Hope this helps!

1 comment

0

So I would have a value in every server of the total amount of sales in that server, and then every time it changes set the async? Won't I get overlaps though, and I want players to be able to see the value of the sales in total, not just in the current server, so I would set the async then I would change the value in that server (and every server) to the async? I am not sure how to do that.

This discussion is preserved as it was. New answers, comments, and votes are closed.