Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

i have already made a script to data store but i dont know where to put it?

local datastore = game:GetService("DataStoreService") local ds2 = datastore:GetDataStore("CashSaveSystem")

game.Players.PlayerAdded:Connect(function(plr) local folder = Instance.new("Folder", plr) folder.Name = "leaderstats" local cash = Instance.new("IntValue", folder) cash.Name = "Cash"

cash.Value = ds2:GetAsync(plr.UserId) or 0
ds2:SetAsnyc(plr.UserId, cash.Value)

end)

1 answer

✓ Accepted answer

Put in the ServerScriptService.

The ServerScriptService is basically the go-to when it comes to data saving, as it functions for all players and to have separate data files.

This discussion is preserved as it was. New answers, comments, and votes are closed.