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

Can someone answer these DataStore questions?

I have a couple of questions about DataStores. My first one is that the key for each player having a value, can the key have multiple values, or would you need to make a custom key name for each thing you want to save? The second question is that if you were to do some sort of inventory system, with datastores, let's say you wanted the value of a key to be the name of a weapon. Could you make the key value a stringvalue, so if you were to iterate through the players values and see if it matches with a tool name and clone it to their backpack?

2 comments

0

Keys should be unique values if you're saving an individual player's values. They're commonly made into a string followed by the player's UserId, i.e. "Key_" .. player.UserId

0

I couldn't fit my reply as a comment so i made it an answer. If you'd like a can show you my datastore script to give you an idea of how its generally set up.

1 answer

Maybe im confused, but i think you are. What you're calling a 'key', is essentially just the players userId. Its used to differentiate between each players save data.

And the second part of your question, what you'd do in that situation is you'd save a table in the data store, you'd save the name of each weapon as a bool. If a player purchases the weapon turn the bool 'true', then have a separate function that on player connect give that player the weapon and add it to their starter pack.

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