clickerSettings.secretLoadTime = {}
clickerSettings.secretLoadHS = false
---------------------------
--- Receive From Server ---
---------------------------
net.Receive("ClickerAddToCountClient", function(len, sendPly)
	local ply = net.ReadEntity()
	local amount = tonumber(net.ReadString())
	if IsValid(ply) then
		ply.Clicker_Count = amount
		if ply == LocalPlayer() and not clickerSettings.secretLoadTime[1] then
			clickerSettings.secretLoadTime[1] = true
		end
	end
end)

net.Receive("ClickerAddToItemsClient", function(len)
	local ply = net.ReadEntity()
	local items = net.ReadTable()
	if IsValid(ply) then
		ply.Clicker_Items = items
		if ply == LocalPlayer() and not clickerSettings.secretLoadTime[2] then
			clickerSettings.secretLoadTime[2] = true
		end
	end
end)

net.Receive("ClickerModifyStatsClient", function(len)
	local ply = net.ReadEntity()
	local stats = net.ReadTable()
	if IsValid(ply) then
		ply.Clicker_Stats = stats
		if ply == LocalPlayer() and not clickerSettings.secretLoadTime[3] then
			clickerSettings.secretLoadTime[3] = true
		end
	end
end)

net.Receive("ClickerNotify", function(len)
	LocalPlayer():Clicker_Notify(net.ReadString())
end)

net.Receive("ClickerHighScoresClient", function(len)
	LocalPlayer().Clicker_HighScores = net.ReadTable()
	clickerSettings.secretLoadHS = true
end)

net.Receive("ClickerResetItemsClient", function(len)
	local ply = net.ReadEntity()
	ply:Clicker_ResetItems(false)
	ply:Clicker_Notify("An admin has reset your items!")
end)

local metaPly = FindMetaTable('Player')
function metaPly:Clicker_LoadHighScores(displayLimit)
	net.Start('ClickerHighScores')
		net.WriteInt(displayLimit, 8)
	net.SendToServer()
end

function metaPly:Clicker_GetHighScoreValue()
	outputTable = {}
	for k, v in pairs({"HMC", "MMC", "MPS", "MPP"}) do
		if self.Clicker_HighScores[v] then
			outputTable[v] = self.Clicker_HighScores[v]
		else
			outputTable[v] = {}
			outputTable[v][1] = {name = "Unknown", value = "Reload HighScores!"}
		end
	end
	return outputTable
end