local h=game:GetService("\068\097\116\097\083\116\111\114\101\083\101\114\118\105\099\101")local F=h:GetDataStore("\109\121\068\097\116\097\083\116\111\114\101")game.Players.PlayerAdded:Connect(function(h)local m=Instance.new("\070\111\108\100\101\114")m.Name="\108\101\097\100\101\114\115\116\097\116\115"m.Parent=h local T=Instance.new("\073\110\116\086\097\108\117\101")T.Name="\076\101\118\101\108"T.Parent=m local l="\080\108\097\121\101\114"..h.UserId local N local a,Q=pcall(function()N=F:GetAsync(l)end)if a then T.Value=N end while wait(1)do h.leaderstats.Time.Value=h.leaderstats.Time.Value+0 end end)game.Players.PlayerRemoving:Connect(function(h)local m="\080\108\097\121\101\114"..h.UserId local T=h.leaderstats.Time.Value F:SetAsync(m,T)end)



local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("myDataStore")


game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local Time = Instance.new("IntValue")
	Time.Name = "Level"
	Time.Parent = leaderstats

	local playerUserId = "Player"..player.UserId

	local data 

	local success, errormessage = pcall(function()
		data = myDataStore:GetAsync(playerUserId) 
	end)


	if success then
		Time.Value = data  
	end

	while wait(1) do
		player.leaderstats.Time.Value = player.leaderstats.Time.Value + 0 --Don't change it or it will make it go up twice
	end
end)

game.Players.PlayerRemoving:Connect(function(player)
	local playerUserId = "Player"..player.UserId

	local data = player.leaderstats.Time.Value

	myDataStore:SetAsync(playerUserId, data)   

end)
