So, I am a noob at scripting and I have no idea how to script a data save script. But, I need one for my game.
01 | local dataStore = game:GetService( "DataStoreService" ):GetDataStore( "MoneyData" ) |
02 |
03 | starterMoney = 0 |
04 |
05 |
06 | game.Players.PlayerAdded:Connect( function (plr) |
07 |
08 | local leaderstats = Instance.new( "Folder" ) |
09 | leaderstats.Name = "leaderstats" |
10 | leaderstats.Parent = plr |
11 |
12 | local money = Instance.new( "IntValue" ) |
13 | money.Name = "Money" --Put your currency |
14 | money.Value = dataStore:GetAsync(plr.UserId) or starterMoney |
15 | money.Parent = leaderstats |