Attempt to index local 'killer' (a nil value)

I’m seeing this error quite a bit in Catalog Heaven, from the “Start game {JOBID} for place” script (basically /Game/GameServer.ashx. It appears that some gear don’t set the kill tag’s Value or don’t set it soon enough.

local tag = humanoid:findFirstChild("creator")

-- find player with name on tag
if tag then
	local killer = tag.Value
	if killer.Parent then -- killer still in game
		return killer
	end
end

To fix this, please change it to:

local tag = humanoid:findFirstChild("creator")

-- find player with name on tag
if tag and tag:IsA("ObjectValue") and tag.Value then
	local killer = tag.Value
	if killer:IsA("Player") and killer.Parent then -- killer still in game
		return killer
	end
end
4 Likes