How can I make a cash on kill system?

I have this tool which checks (on the server) if its handle has touched any other part and if it does it kills the other part if it has a humanoid. I want to make it so when the player kills the other player, it will give the player holding the tool some exp.

I am a little confused on how I can add this and this is what I have currently got:

local Tool = script.Parent
local Handle = Tool.MeshPart

Handle.Touched:Connect(function(OtherPart)
	local EnemyHumanoid = OtherPart.Parent:FindFirstChildWhichIsA("Humanoid")
	
	if EnemyHumanoid then
		Tool.Activated:Wait() -- Checks if the tool was clicked  before damaging Humanoid
		
		EnemyHumanoid:TakeDamage(100)
	end
end)

How would I add this system into this script I currently have?

You first need to fix this script to prevent memory leaks. You should ask that in #help-and-feedback:code-review, but for now, you’d basically use Players:GetPlayerFromCharacter(Tool.Parent).leaderstats.Exp.Value += 1

1 Like

Just made a topic about it:

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