Kills/Deaths Leaderboard

I’m making a replica of Classic: Rocket Arena, and I’m trying to make them as similar as possible. I’m adding a kills/deaths leaderboard to almost completely finish this replica, but there’s 2 problems.

Those 2 are…

  1. Rocket Kills don’t count as a kill, as it’s the only way to kill someone in this game.
  2. When you touch the lava on the edges, doing so counts as 2 deaths.

So far, I’ve surfed the internet to look for any possible solutions, but none worked. And when I went to look on the DevForum, nothing matched the problem I had.

Here’s all my code:

local plrs = game.Players
local temp = Instance.new 'BoolValue'
temp.Name = 'leaderstats'

Instance.new('IntValue', temp).Name = "KOs"
Instance.new('IntValue', temp).Name = "WOs"

plrs.PlayerAdded:Connect(function(plr)
	wait(1)
	local stats = temp:Clone()
	stats.Parent = plr
	local deaths = stats.WOs
	plr.CharacterAdded:Connect(function(char)
		deaths.Value = deaths.Value + 1
		local humanoid = char:FindFirstChild "Humanoid"
		if humanoid then
			humanoid.Died:Connect(function()
				deaths.Value = deaths.Value + 1
				for i, child in pairs(humanoid:GetChildren()) do
					if child:IsA('ObjectValue') and child.Value and child.Value:IsA('Player') then
						local ko = child.Value
						if ko:FindFirstChild 'leaderstats' and ko.leaderstats:FindFirstChild "KOs" then
							local kills = ko.leaderstats.KOs
							kills.Value = kills.Value + 1
						end
						return
					end
				end
			end)
		end
	end)
end)

When player A fires a rocket and kills player B, just add an attribute to player B stating why they died. You can then check this attribute for the reason and reject adding kills.

For the lava death part, it’s the same idea. Add an attribute for the cause of death then check it

Edit: It would look like this:

--When lava kills player for example
humanoid:TakeDamage(100)
humanoid:SetAttribute("DeathReason", "Lava")
--On the humanoid died event
local Reason = humanoid:GetAttribute("DeathReason")

if Reason == "Lava" then 
 --Make it two deaths
end

unfortunately i didn’t find a way to link the rocket boosters with the kill count.

How did you link them? Was it my method?

thank you for helping. i was able to find a way to link them, just spoke too soon.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.