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

Leaderboard Saving Wont Work? (Unanswered)

SecondsKey = "SecondsPlayed"

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

game.Players.PlayerRemoving:connect(function(player)
	player:SaveNumber(SecondsKey, player.leadrstats.SecondsPlayed.Value)
end)

The saving doesn't work when I rejoin, I also shutdown all servers and rejoined. It still didn't work.

2 comments

0

You misspelled leaderstats on line 22. And have the script load the number before the while loop. And put SecondsKey in quotations, since those are supposed to be string values to identify them.

0

Still won't work... I posted the question again with the new code..

1 answer

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