local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local gunIsFiring = false
local enabled = false
local on = false
mouse.Button1Down:connect(function()
		
		if script.Parent.Ammo.Value > 0 and enabled == false then
		gunIsFiring = true
			script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
		local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
		local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
 
		local beam = Instance.new("Part", workspace)
		beam.BrickColor = player.TeamColor
		beam.FormFactor = "Custom"
		beam.Material = "Neon"
		beam.Transparency = 0.25
		beam.Anchored = true
		beam.Locked = true
		beam.CanCollide = false
        tool.Handle.FireSound:Play()
		local distance = (tool.Hole.CFrame.p - position).magnitude
		beam.Size = Vector3.new(0.2, 0.2, distance)
		beam.CFrame = CFrame.new(tool.Hole.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
 
		game:GetService("Debris"):AddItem(beam, 0.1)
 
		if part then
			local humanoid = part.Parent:FindFirstChild("Humanoid")
 
			if not humanoid then
				humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
			end
 
			if humanoid then
				humanoid:TakeDamage(20)
			
				
			end
		end
		end
		if script.Parent.Ammo.Value == 0 and enabled == false then
			gunIsFiring = false
			enabled = true
			on = true
	end
(end)

It can kill and stuff, but how can I tag the player that died so it can count as a kill?