Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DataStore = game:GetService("DataStoreService") -- getting the data store
- local dsc = DataStore:GetDataStore("CashSaveSystem") -- making a new datastore
- local dsa = DataStore:GetDataStore("AbbosSaveSystem")
- local dsv = DataStore:GetDataStore("VidsSaveSystem")
- game.Players.PlayerAdded:Connect(function(player)-- function when you join
- local leaderstats = Instance.new("IntValue")
- leaderstats.Name = "leaderstats"
- leaderstats.Parent = player
- local Cash = Instance.new("IntValue", leaderstats)
- Cash.Name = "cash"
- Cash.Value = 0
- Cash.Parent = leaderstats
- local Abbonees = Instance.new("IntValue",leaderstats)
- Abbonees.Name = "abbonees"
- Abbonees.Value = 0
- Abbonees.Parent = leaderstats
- local Videos = Instance.new("IntValue",leaderstats)
- Videos.Name = "videos"
- Videos.Value = 0
- Videos.Parent = leaderstats
- dsc:GetAsync(player.UserId + "Cash") -- saving the value
- dsa:GetAsync(player.UserId + "Abbos") -- saving the value
- dsv:GetAsync(player.UserId + "Vids") -- saving the value
- end)
- game.Players.PlayerRemoving:Connect(function(player) -- when you leave
- dsc:SetAsync(player.UserId + "Cash", player.leaderstats.Cash.Value) -- saving the value
- dsa:SetAsync(player.UserId + "Abbos", player.leaderstats.Abbonees.Value) -- saving the value
- dsv:SetAsync(player.UserId + "Vids", player.leaderstats.Videos.Value) -- saving the value
- end)
Advertisement
Add Comment
Please, Sign In to add comment