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.
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 //-- |
02 | local datastoreservice = game:GetService( 'DataStoreService' ) |
03 | --\\ DataStores //-- |
04 | local datastore = datastoreservice:GetDataStore( 'pointsTable' ) |
05 | --\\ Values //-- |
06 | local sessiondata = { } |
07 | --\\ Functions //-- |
08 | local 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) |