Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Data Persistance Leaderboard Won't Work? I fixed Some Problems.

game.Players.PlayerAdded:connect(function(player)
	player:WaitForDataReady()	
	print("Player Data Ready")
	leaderstats = Instance.new("IntValue")
	leaderstats.Parent = player
	leaderstats.Name = "leaderstats"
	
	SecondsPlayed = Instance.new("IntValue")
	SecondsPlayed.Parent = leaderstats
	SecondsPlayed.Name = "Seconds Played"
	SecondsPlayed.Value = 0
	SecondsPlayed.Value = player:LoadNumber("SecondsPlayed")
	while wait(1) do
		SecondsPlayed.Value = SecondsPlayed.Value +1
	end	
end)

game.Players.PlayerRemoving:connect(function(player)
	player:SaveNumber("SecondsPlayed", player.leaderstats.SecondsPlayed.Value)
end)

1 answer

I can offer some advice, remove lines 13-15 and make a seperate script to put inside the value, inside the second script put.

while true do
wait(1)
script.Parent.Value = script.Parent.Value+1

If this worked thumbs up the answer :)

This discussion is preserved as it was. New answers, comments, and votes are closed.