Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I create DataStores?

Asked by
Asigkem 32
8 years ago

I understand how to retrieve things from Data Stores, thanks to the wiki, but I don't understand quite how to make one.

Say, for instance, I wanted to make a data store like this:

Store name: pointsTable "usr_"..player.PlayerId | Points

How exactly would I be able to create this? And is it possible to have multiple value columns like Points, Kills, Deaths, for example? Thank you.

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

Okay first off yes you can store values in columns its called a table/array and you put those in the table. here is a sample code because I'm sure you understand how to do this and I don't really understand how to explain it. if you have any more questions feel free to PM me or put a comment so I can help you out some more.

01--\\ Services //--
02local datastoreservice = game:GetService('DataStoreService')
03--\\ DataStores //--
04local datastore = datastoreservice:GetDataStore('pointsTable')
05--\\ Values //--
06local sessiondata = {}
07--\\ Functions //--
08local function onPlayerAdded(player)
09    local leaderstats = Instance.new('Folder')
10    leaderstats.Name = 'leaderstats'
11    local points = Instance.new('IntValue', leaderstats)
12    points.Name = 'Points'
13    local kills = Instance.new('IntValue', leaderstats)
14    kills.Name = 'Kills'
15    local deaths = Instance.new('IntValue', leaderstats)
View all 50 lines...
Ad

Answer this question