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.
COMMUNITY QUESTION
I am a noob scripter, and I need to know how to create a data save script?
1 answer
local dataStore = game:GetService("DataStoreService"):GetDataStore("MoneyData")
starterMoney = 0
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local money = Instance.new("IntValue")
money.Name = "Money" --Put your currency
money.Value = dataStore:GetAsync(plr.UserId) or starterMoney
money.Parent = leaderstats
end)
game.Players.PlayerRemoving:Connect(function(plr)
dataStore:SetAsync(plr.UserId, plr.leaderstats.Money.Value)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
you can't simply use "im noob at scripting" as an excuse to not need to any work trying to create what you wanna create, you can try searching data store service, or a youtube tutorial.
ugh fineeee