Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local players = game.Players
- local DSS = game:GetService("DataStoreService")
- local DataStore = DSS:GetDataStore("DataStore")
- players.PlayerAdded:Connect(function(plr)
- local leaderstats = Instance.new("Folder")
- leaderstats.Name = "leaderstats"
- local coins = Instance.new("IntValue")
- coins.Name = "Coins"
- coins.Value = 250 -- change this to whatever you want, preferable a low value
- local bag = Instance.new("IntValue")
- bag.Name = "Bag"
- bag.Value = 0
- local data
- local success, errorMessage = pcall(function()
- data = DataStore:GetAsync(plr.UserId)
- end)
- if success and data ~= nil then
- print("Data successfully loaded!")
- coins.Value = coins.info-- If you named Cash to Money, write Money here instead
- else
- warn(errorMessage)
- end
- leaderstats.Parent = plr
- coins.Parent = leaderstats
- bag.Parent = leaderstats
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement