local ds = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(plr)
	wait()
	local plrkey = "id_"..plr.userId
	local save1 = plr.leaderstats.Clicks
	local save2 = plr.leaderstats.Rebirths
	local save3 = plr.leaderstats.Gems

	local GetSaved = ds:GetAsync(plrkey)
	if GetSaved then
		save1.Value = GetSaved[1]
		save2.Value = GetSaved[2]
		save3.Value = GetSaved[3]
	else
		local NumberForSaving = {save1.Value,save2.Value,save3.Value}
		ds:GetAsync(plrkey,NumberForSaving)
	end
end)

game.Players.PlayerRemoving:Connect(function(plr)
	ds:SetAsync("id_"..plr.userId,{plr.leaderstats.Rebirths.Value,plr.leaderstats.Clicks,plr.leaderstats.Gems.Value})
end)

[Edit by JesseSong:]

Please provide a description of your question; as it'll be more easier to answer your question correctly, if you'd like, you can visit this page to learn how to set up a good question/answer.

If you continue to post non - descriptive questions, your question will be moderated!

Thanks, JesseSong!

1 comment

1

I can’t read this, format it better and maybe I’ll actually answer