function onHumanoidDied(m,M)local C=M:findFirstChild("\108\101\097\100\101\114\115\116\097\116\115")if C~=nil then local r=C:findFirstChild("\087\105\112\101\111\117\116\115")r.Value=r.Value+1 local e=getKillerOfHumanoidIfStillInGame(m)handleKillCount(m,M)end end function onPlayerRespawn(m,M)if m=="\067\104\097\114\097\099\116\101\114"and M.Character~=nil then local m=M.Character.Humanoid local C=M m.Died:connect(function()onHumanoidDied(m,C)end)end end function getKillerOfHumanoidIfStillInGame(m)local M=m:findFirstChild("\099\114\101\097\116\111\114")if M~=nil then local m=M.Value if m.Parent~=nil then return m end end return nil end function handleKillCount(m,M)local C=getKillerOfHumanoidIfStillInGame(m)if C~=nil then local m=C:findFirstChild("\108\101\097\100\101\114\115\116\097\116\115")if m~=nil then local r=m:findFirstChild("\075\079\115")if C~=M then r.Value=r.Value+1 else r.Value=r.Value-1 end end end end function onPlayerEntered(m)local M=Instance.new("\073\110\116\086\097\108\117\101")M.Name="\108\101\097\100\101\114\115\116\097\116\115"local C=Instance.new("\073\110\116\086\097\108\117\101")C.Name="\075\079\115"C.Value=0 local r=Instance.new("\073\110\116\086\097\108\117\101")r.Name="\087\105\112\101\111\117\116\115"r.Value=0 C.Parent=M r.Parent=M while true do if m.Character~=nil then break end wait(5)end local e=m.Character.Humanoid e.Died:connect(function()onHumanoidDied(e,m)end)m.Changed:connect(function(M)onPlayerRespawn(M,m)end)M.Parent=m end game.Players.ChildAdded:connect(onPlayerEntered)
--Made by Stickmasterluke

function onHumanoidDied(humanoid, player)
	local stats = player:findFirstChild("leaderstats")
	if stats ~= nil then
		local deaths = stats:findFirstChild("Wipeouts")
		deaths.Value = deaths.Value + 1
		local killer = getKillerOfHumanoidIfStillInGame(humanoid)
		handleKillCount(humanoid, player)
	end
end

function onPlayerRespawn(property, player)
	if property == "Character" and player.Character ~= nil then
		local humanoid = player.Character.Humanoid
		local p = player
		humanoid.Died:connect(function()
			onHumanoidDied(humanoid, p)
		end)
	end
end

function getKillerOfHumanoidIfStillInGame(humanoid)
	local tag = humanoid:findFirstChild("creator")
	if tag ~= nil then
		local killer = tag.Value
		if killer.Parent ~= nil then
			return killer
		end
	end
	return nil
end

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)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"
	local kills = Instance.new("IntValue")
	kills.Name = "KOs"
	kills.Value = 0
	local deaths = Instance.new("IntValue")
	deaths.Name = "Wipeouts"
	deaths.Value = 0
	kills.Parent = stats
	deaths.Parent = stats

	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)

	newPlayer.Changed:connect(function(property)
		onPlayerRespawn(property, newPlayer)
	end)

	stats.Parent = newPlayer
end

game.Players.ChildAdded:connect(onPlayerEntered)
