local startamount = 0
local DataStore = game:GetService(“DataStoreService”)
local ds = DataStore:GetDataStore(“Clickssave”)
local ds1 = DataStore:GetDataStore(“Gemssave”)
local ds2 = DataStore:GetDataStore(“Rebirthsssave”)
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new(“Folder”,player)
leaderstats.Name = “leaderstats”
local Clicks = Instance.new(“IntValue”,leaderstats)
Clicks.Name = “Clicks”
Clicks.Value = ds:GetAsync(player.UserId) or startamount
ds:SetAsync(player.UserId, Clicks.Value)
Clicks.Changed:connect(function()
ds:SetAsync(player.UserId, Clicks.Value)
end)
local Rebirths = Instance.new(“IntValue”,leaderstats)
Rebirths.Name = “Rebirths”
Rebirths.Value = ds2:GetAsync(player.UserId) or startamount
ds2:SetAsync(player.UserId, Rebirths.Value)
Rebirths.Changed:connect(function()
ds:SetAsync(player.UserId, Rebirths.Value)
end)
local Gems = Instance.new(“IntValue”,leaderstats)
Gems.Name = “Gems”
Gems.Value = ds1:GetAsync(player.UserId) or startamount
ds1:SetAsync(player.UserId, Gems.Value)
Gems.Changed:connect(function()
ds:SetAsync(player.UserId, Gems.Value)
end)
end)
game.Players.PlayerRemoving:connect(function(player)
ds:SetAsync(player.UserId, player.leaderstats:WaitForChild(“Clicks”).Value)
ds1:SetAsync(player.UserId, player.leaderstats:WaitForChild(“Gems”).Value)
ds2:SetAsync(player.UserId, player.leaderstats:WaitForChild(“Rebirths”).Value)
end)