Datastore looks difficult, and can be very difficult when you don't understand it, and I agree with you completely that wiki isn't the best place to learn
That's why I'll try to explain, first, you CANNOT save instances, however, you can save all the data required to build them, like position. You can save bools, ints, tables,...
First thing you always have to do is get the datastore service
1 | local DataStore = game:GetService( "DataStoreService" ) |
You also have to get the datastore you want to use
1 | local PlayerSave = DataStore:GetDataStore( "PS_" ..dataNum) |
You could just use 'PlayerDatastore' or anything really but if I want to reset a datastore I just have to change a variable and done, you CANNOT delete a datastore!
To set a value to the datastore you have to use SetAsync or IncrementAsync, I never use the second one though
You also have to use a key, the key is mostly the players userId, so the datastore isn't for one player only
Example
1 | local DataStore = game:GetService( "DataStoreService" ) |
2 | local PlayerSave = DataStore:GetDataStore( 'PlayerDataStore' ) |
4 | game.Players.PlayerAdded:connect( function (plr) |
6 | local money = plr:WaitForChild( 'Money' ) |
8 | PlayerSave:SetAsync(key, money.Value) |
Ofcourse you will never use the example above, because this sets a value on a players spawn.
You can get a value from a datastore you have to use GetAsync, like this, you don't have to type in your variable next to the key, just put it in a variable like in the example
1 | local DataStore = game:GetService( "DataStoreService" ) |
2 | local PlayerSave = DataStore:GetDataStore( 'PlayerDataStore' ) |
4 | game.Players.PlayerAdded:connect( function (plr) |
6 | local money = plr:WaitForChild( 'Money' ) or 0 |
8 | money.Value = = PlayerSave:GetAsync(key) |
Important: in local money = plr:WaitForChild('Money') or 0 I add the *or 0 *because if the player has never played before we need to set his stats to 0
Also important: Datastores have limits, if you keep sending data to the datastore it will maybe lose that data, so it's important you don't let the players save all the time, you could use this in a loop to 'autosave'.
If there is anything more you don't understand, or ask it, or try to find it here http://wiki.roblox.com/index.php/Data_store I wouldn't recommend watching videos as they use bad scripts most of the time
Also, error handling is very important, not neccesary but if you have a huge game you should look into it, good luck :P