GameServer.ashx error(s)

I was testing my leaderboard, and look what I came across:

It’s trying to index a property of the ‘Team’ object which I inserted (I was using ‘Team’ because it had the TeamColor property, which my leaderboard uses) and because of that, it’s erroring.

Relevant part of code from GameServer.ashx, with the changes commented:

if placeId~=nil and killID~=nil and deathID~=nil and url~=nil then
	-- listen for the death of a Player
	function createDeathMonitor(player)
		if player.Character then
			local humanoid = waitForChild(player.Character, "Humanoid")
			humanoid.Died:connect(
				function ()
					onDied(player, humanoid)
				end
			)
		end
	end

	game:GetService("Players").ChildAdded:connect( -- This should be changed to  '.PlayerAdded'
		function (player)
			-- Or preform a check to make sure that the child actually is a Player object.
			createDeathMonitor(player)
			player.Changed:connect(
				function (property)
					if property=="Character" then
						createDeathMonitor(player)
					end
				end
			)
		end
	)
end

Another really often error I see is that there is no check that the value of a creator tag for KOs is non-nil before getting the parent of it.

Yeah, that should be fixed too.

function getKillerOfHumanoidIfStillInGame(humanoid)

	local tag = humanoid:findFirstChild("creator")

	if tag then
		local killer = tag.Value
		if killer.Parent then -- This should be changed to 'killer and killer.Parent'
			return killer
		end
	end

	return nil
end

This really isn’t worth fixing because the process for updating GameServer.ashx is way too complicated. There are a couple of other ways you can cause errors in this script, like parenting a creator tag which doesn’t have a Value property.

Roblox doesn’t seem to like children of Players that aren’t, well, Player-s.

See also The PlayerList script