function Entered(o)if o:findFirstChild("\108\101\097\100\101\114\115\116\097\116\115")==nil then stats=Instance.new("\073\110\116\086\097\108\117\101")stats.Parent=o stats.Name="\108\101\097\100\101\114\115\116\097\116\115"money=Instance.new("\073\110\116\086\097\108\117\101")money.Value=0 money.Name="\077\111\110\101\121"money.Parent=stats ao=Instance.new("\073\110\116\086\097\108\117\101")ao.Value=0 ao.Name="\065\108\114\101\097\100\121\079\119\110\101\100"ao.Parent=o end end game.Players.PlayerAdded:connect(Entered)p=game.Players:GetChildren()for o=1,#p,1 do Entered(p[o])end print("\076\105\110\107\101\100\076\101\097\100\101\114\098\111\097\114\100 \115\099\114\105\112\116 \118\101\114\115\105\111\110 \053\046\048\048 \108\111\097\100\101\100")stands={}CTF_mode=false function handleKillCount(o,G)local m=getKillerOfHumanoidIfStillInGame(o)if m~=nil then local o=m:findFirstChild("\108\101\097\100\101\114\115\116\097\116\115")if o~=nil then local O=o:findFirstChild("\075\079\115")if m~=G then O.Value=O.Value+1 else O.Value=O.Value-1 end end end end function onPlayerEntered(o)if CTF_mode==true then local G=Instance.new("\073\110\116\086\097\108\117\101")G.Name="\108\101\097\100\101\114\115\116\097\116\115"captures.Parent=G while true do if o.Character~=nil then break end wait(5)end G.Parent=o else local G=Instance.new("\073\110\116\086\097\108\117\101")G.Name="\108\101\097\100\101\114\115\116\097\116\115"local m=Instance.new("\073\110\116\086\097\108\117\101")m.Name="\075\079\115"m.Value=0 m.Parent=G deaths.Parent=G while true do if o.Character~=nil then break end wait(5)end local O=o.Character.Humanoid O.Died:connect(function()onHumanoidDied(O,o)end)o.Changed:connect(function(G)onPlayerRespawn(G,o)end)G.Parent=o end end
-- NintendoZERG

function Entered(p)
	if p:findFirstChild("leaderstats") == nil then
		stats = Instance.new("IntValue")
		stats.Parent = p
		stats.Name = "leaderstats"

		money = Instance.new("IntValue")
		money.Value = 0 -- How much money each player starts with.
		money.Name = "Money"
		money.Parent = stats

		ao = Instance.new("IntValue")
		ao.Value = 0
		ao.Name = "AlreadyOwned"
		ao.Parent = p
	end
end

game.Players.PlayerAdded:connect(Entered)

p = game.Players:GetChildren()
for i = 1, #p do
	Entered(p[i])
end
print("LinkedLeaderboard script version 5.00 loaded")

stands = {}
CTF_mode = false

function handleKillCount(humanoid, player)
	local killer = getKillerOfHumanoidIfStillInGame(humanoid)
	if killer ~= nil then
		local stats = killer:findFirstChild("leaderstats")
		if stats ~= nil then
			local kills = stats:findFirstChild("KOs")
			if killer ~= player then
				kills.Value = kills.Value + 1
			else
				kills.Value = kills.Value - 1
			end
		end
	end
end

function onPlayerEntered(newPlayer)
	if CTF_mode == true then
		local stats = Instance.new("IntValue")
		stats.Name = "leaderstats"

		captures.Parent = stats

		-- VERY UGLY HACK
		-- Will this leak threads?
		-- Is the problem even what I think it is (player arrived before character)?
		while true do
			if newPlayer.Character ~= nil then
				break
			end
			wait(5)
		end

		stats.Parent = newPlayer
	else
		local stats = Instance.new("IntValue")
		stats.Name = "leaderstats"

		local kills = Instance.new("IntValue")
		kills.Name = "KOs"
		kills.Value = 0

		kills.Parent = stats
		deaths.Parent = stats

		-- VERY UGLY HACK
		-- Will this leak threads?
		-- Is the problem even what I think it is (player arrived before character)?
		while true do
			if newPlayer.Character ~= nil then
				break
			end
			wait(5)
		end

		local humanoid = newPlayer.Character.Humanoid

		humanoid.Died:connect(function()
			onHumanoidDied(humanoid, newPlayer)
		end)

		-- start to listen for new humanoid
		newPlayer.Changed:connect(function(property)
			onPlayerRespawn(property, newPlayer)
		end)

		stats.Parent = newPlayer
	end
end
