Missing something with KO's on leaderstats (Rocket Launcher)

Hi I need to put ko’s on leaderstats with the old Rocket Launcher tried everything I must be doing something wrong. I am trying to add KO’s to the old capture the flag game. Do I need to put creator tag in the weapon? (If so which part) Or is the creator tag in the player? only seen the old classic sword? Do I take this creator tag or is there a new better way? I still need captures to work.RED vs BLUE - SPACE BATTLE- AMONG US with HUGGYs - Roblox.

Could you please reorganize this topic, it seems quite messy and hard to read. Can you also show your code otherwise we would not be able to help you.

i dont understand what you mean

Sorry yes I have re-organised. Apologies. I Am new to scripting and I am afraid I have been reading tutorials inspecting other peoples scripts to learn. I have tried them out read them kind of understand them (after two years on here). I would appreciate being pointed in the right direction as I have been going round in circles. I could put one of the scripts that doesnt work on here but I have tried so many and have just got more confused.

1 Like

I basically have used the capture the flag template, Built my own game around it. Now To improve the game I would like to add KO’s and WO’s so the weapon is the rocket launcher that comes with capture the flag.

Simple? I thought so but I must be missing something.

Ok so basically i’m gonna guess that you want to add a kills counter and death counter for the default “Capture the Flag” template. And the problem you are currently facing is that you do not know wether to put the “Creator Tag” (I would guess thats the tag that would be used to see who is USING the weapon to deal dmg) in the player, the weapon, or something else.

Anyways i’m not familier with these systems, however, I do believe you want to put it into the bullet of the weapon (since its a rocket launcher), or possibly even the explosion if thats a part.

Ah yes, this old topic should help: Kill counter increases whenever you shoot a dead player more

Putting this code on ServerScriptService should display a leaderboard.

local Players = game:GetService("Players")
 
local function leaderboardSetup(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
 
	local ko = Instance.new("IntValue")
	ko.Name = "KOs"
	ko.Value = 0
	ko.Parent = leaderstats
end

Players.PlayerAdded:Connect(leaderboardSetup)

Idk how to count the times a player has been killed but the topic that @PANDASonNOOB said might be useful

Thanks I can get the leaderboard to set up ok but it is not registering the KO’s I have tried many different scripts but they either dont dont show KO’s or miss out the flag captures.

1 Like

Maybe using Humanoid.Died on the leaderboard script could work

game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
			ko.Value += 1
		end)
	end)
end)

That looks good, thanks will test and let you know. may be a while…
I must have seen 20 other posts but not that one. Nothing ‘in the weapon’ in this one.

There aint nothing in the weapon because it’s accessing the weapon as “Model” through the script by finding it in game.workspace
Putting it inside the weapon might still sometimes help since you can more easily find the weapon just by doing “Script.Parent”
Although it really depends.

Hi I hoped this would give me ko,s wo’s and killstreak on top of flag captures that I started with. It gives me WO’s but have lost captures (serverscriptservice) no kills etc. I followed your suggestion. it has code for damage but I am not sure where to put it. I parented it to remote function (Damage). The other part of the suggestion put a humanoiddiedscript in characterscripts.
No changes were detected.

local DSS = game:GetService(“DataStoreService”)
local MyDS = DSS:GetDataStore(“myDataStore”)

game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new(“Folder”, plr); leaderstats.Name = “leaderstats”;
local kills = Instance.new(“IntValue”, leaderstats); kills.Name = “Kills”;

local Deaths = Instance.new("IntValue", leaderstats); Deaths.Name = "Deaths";
local KillStreak = Instance.new("IntValue", leaderstats); KillStreak.Name = "killStreak";

plr.CharacterAdded:Connect(function(character)
	local humanoid = character:FindFirstChild("Humanoid")

	humanoid.Died:Connect(function(died)
		Deaths.Value += 1
		KillStreak.Value = 0

		local tag = humanoid:FindFirstChild("creator")
		local killer = tag.Value

		if tag and killer then
			killer.leaderstats:FindFirstChild("Kills").Value += 1
			killer:FindFirstChild("killstreak").Value += 1
		end
	end)
end)

end)

Ok Thanks for your suggestions. I was going round in circles. I solved the problem by starting again! the leaderstat board was not the problem it was the creator tag in weapons. I had to rescript my weapons.

I had mixed up globals as well.