Help with punching script

I want to make a simple punch script for a skinned mesh player that hurts other skinned meshes’ humanoid.

The animations work perfectly, I just don’t know how to do the punching script. I tried to make a script that goes like this:

local userinput = game:GetService("UserInputService")
local player = script.Parent.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage.Events:WaitForChild("punchdamage")
player.CharacterAdded:Wait()
local fightanims = player.Character:WaitForChild("FightAnims")
local lp = fightanims.PunchLeft
local rp = fightanims.PunchRight
local animator = fightanims.Parent.Humanoid.Animator
local rpanim = animator:LoadAnimation(rp)
local lpanim = animator:LoadAnimation(lp)
userinput.InputBegan:Connect(function(input, gameprocessedevent)
	if gameprocessedevent then
		return
	end
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		print("click1")
		lpanim:Play()
-- (I erased this part, but basically what it did is to connect a function that deals damage to the enemy's humanoid if it's touched [obviously it didn't work because it activated even when it's not punching])
	elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
		print("click2")
		rpanim:Play()
-- (same with this part)
	end
end)

and also i tried to do it in another way using these two scripts that just don’t work:
localscript

local userinput = game:GetService("UserInputService")
local player = script.Parent.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage.Events:WaitForChild("punchdamage")
player.CharacterAdded:Wait()
local fightanims = player.Character:WaitForChild("FightAnims")
local lp = fightanims.PunchLeft
local rp = fightanims.PunchRight
local animator = fightanims.Parent.Humanoid.Animator
local rpanim = animator:LoadAnimation(rp)
local lpanim = animator:LoadAnimation(lp)
userinput.InputBegan:Connect(function(input, gameprocessedevent)
	if gameprocessedevent then
		return
	end
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		print("click1")
		lpanim:Play()
		Remote:FireServer()
	elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
		print("click2")
		rpanim:Play()
		Remote:FireServer()
	end
end)

script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage.Events:WaitForChild("punchdamage")

Remote.OnServerEvent:Connect(function(Player)
	print("pow")
	local Character = Player.Character
	local Humanoid = Character:WaitForChild("Humanoid")

	local Params = RaycastParams.new()
	Params.FilterType = Enum.RaycastFilterType.Blacklist
	Params.FilterDescendantsInstances = {Character}

	local Origin = Character.HumanoidRootPart.Position
	local Direction = Character.HumanoidRootPart.CFrame.LookVector * 5
	local Result = workspace:Raycast(Origin, Direction, Params)
	
	if Result then
		print("hit!")
		local critchance = math.random(1, 25)
		local critmultiplier = 1
		if critchance == 1 then
			critmultiplier = 2
		else
			critmultiplier = 1
		end
		local Damage = math.random(1,3) * critmultiplier
		local Part = Result.Instance
		local Enemy = Part:FindFirstAncestorOfClass("Model"):FindFirstChild("Humanoid")

		if Enemy and Enemy:GetState() ~= Enum.HumanoidStateType.Dead then
			Enemy:TakeDamage(Damage)
			print(Enemy.." took "..Damage.." damage")
		end
	end
end)

I’m trying in a million ways but none seem to work. Help!

Physics isnt applied to skinned mesh deformation. So if youre trying to detect the hits on the actual mesh, this wont work. Try attaching parts to the actual bones of your mesh to act as collision models.

You could try welding a hitbox to each arm and then detecting when they are touched.