How do I code a hitbox

So like when the player presses F it does a punch (which I have already, using userinputservice) but um how do I make it so if the player touches the NPC when they click F, it does damage

local UserInputService = game:GetService("UserInputService")
local Humanoid = game.Workspace.TestingNPCForWalking.Humanoid

UserInputService.InputBegan:Connect(function(input,gameProccesedEvent)
	if input.KeyCode == Enum.KeyCode.F then
		print("Test")
	end
end)

So in the print(“Test”) area it should like do damage to the NPC if it’s hit

I highly suggest you use magnitude instead.

for _, npc in pairs(GroupOfNpcs) do
    if (npc.HumanoidRootPart.Position - character.HumanoidRootPart.Position).mganitude <= 5 then -- change 5 to your max distance
        -- stuff
    end
end