I've been dealing with this problem for days. A localscript fires the event and this is in the serverscript Nothing comes up in the console

event.OnServerEvent:connect(function(player) local ray = Ray.new(player.Character.Head.CFrame.p, (mouse.Hit.p - player.Character.Head.CFrame.p).unit * 300) local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) local mouse = player:GetMouse()

	local beam = Instance.new("Part", workspace)
	beam.BrickColor = BrickColor.new("Bright red")
	beam.FormFactor = "Custom"
	beam.Material = "Neon"
	beam.Transparency = 0.25
	beam.Anchored = true
	beam.Locked = true
	beam.CanCollide = false

	local distance = (player.Character.Head.CFrame.p - position).magnitude
	beam.Size = Vector3.new(0.3, 0.3, distance)
	beam.CFrame = CFrame.new(player.Character.Head.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(30)
		end
	end

end)