How to use creator tag?

I want to add a leaderboard with kills in my game. But I don’t know how to determine which player killed who? So How can I do it using creator tags. Just an example of how to implement it in the tool that kills and the leaderboard script

3 Likes

When a npc/player is killed by a player/npc, there is a ‘creator’ tag in the humanoid, which checks who killed that npc/player.

You can do something like this -

player.CharacterAdded:Connect(function(char)
		char.Humanoid.Died:Connect(function(Died)
			local creator = char.Humanoid:FindFirstChild("creator")
			local leaderstats = creator.Value:FindFirstChild("leaderstats")
			if creator~=nil and creator.Value ~= nil then
				leaderstats.Money.Value = leaderstats.Money.Value + 5
				leaderstats.Kills.Value = leaderstats.Kills.Value + 1
			end	
		end)
	end)

We’re checking when the player dies, and then we’re looking for that ‘creator’ tag under his humanoid, we’re then getting the leaderstats through the creator tag value, and award the killer.

12 Likes