Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 1luvcherries
- local DSService = game:GetService("DataStoreService")
- local Players = game:GetService("Players")
- local RStorage = game:GetService("ReplicatedStorage")
- local Codes = DSService:GetDataStore("CodesPlrs")
- local DS_Clicks = DSService:GetOrderedDataStore("Clicks")
- local DS_Rebirths = DSService:GetOrderedDataStore("Rebirths")
- local CodeList = require(RStorage.Modules.Codes)
- Players.PlayerAdded:Connect(function(Player)
- local Leaderstats = Instance.new("Folder")
- Leaderstats.Parent = Player
- Leaderstats.Name = "leaderstats"
- local Clicks = Instance.new("IntValue")
- Clicks.Parent = Leaderstats
- Clicks.Name = "Clicks"
- local Rebirths = Instance.new("IntValue")
- Rebirths.Parent = Leaderstats
- Rebirths.Name = "Rebirths"
- pcall(function()
- if not Codes:GetAsync(Player.UserId) then
- local Compiled = {}
- for code, callback in CodeList do
- Compiled[code] = true
- end
- Codes:SetAsync(Player.UserId, Compiled)
- end
- end)
- pcall(function()
- Clicks.Value = DS_Clicks:GetAsync(Player.UserId) or 0
- end)
- pcall(function()
- Rebirths.Value = DS_Rebirths:GetAsync(Player.UserId) or 0
- end)
- end)
- Players.PlayerRemoving:Connect(function(Player)
- pcall(function()
- DS_Clicks:SetAsync(Player.UserId, Player.leaderstats.Clicks.Value)
- end)
- pcall(function()
- DS_Rebirths:SetAsync(Player.UserId, Player.leaderstats.Rebirths.Value)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement