Why is it doing more damage than normal

Basically its a punching script it plays animations when you click and when u click before you approach humanoid like spam click then it will build up damage like if it was doing += to a variable but its only suppose to do 10 damage on the humanoid each time you punch

-- local serverStorage = game:GetService("ServerStorage")
local anim = serverStorage:FindFirstChild("Animation")
local anim2 = serverStorage:FindFirstChild("Animation2")
local replicatedStorage = game:GetService("ReplicatedStorage")
local startAnimEvent = replicatedStorage:FindFirstChild("StartAnim")
local players = game:GetService("Players")
local char = script.Parent
local animation = char.Humanoid:LoadAnimation(anim)
local animation2 = char.Humanoid:LoadAnimation(anim2)
local flag = 0 --  left arm flag 
local flag2 = 0 -- right arm  flag
local flag3 = true -- flag damage 1 left arm
local flag4 = true -- flag damage 2 right arm
local damage = 10


local function commitDamage(part)
	part.Parent.Humanoid.Health = part.Parent.Humanoid.Health - damage
	workspace.HitSound:Play()
end

startAnimEvent.OnServerEvent:Connect(function(plr,msg)
	char = plr.Character 
	local animation = char.Humanoid:LoadAnimation(anim)
	local animation2 = char.Humanoid:LoadAnimation(anim2)
	local message = msg
	if flag == 0 then
	    flag2 = 1
		flag = 1
		animation:Play()
		
		if flag3 then
			print(msg)
			char["Left Arm"].Touched:Connect(function(part)
				if part.Parent.Humanoid and message == "PunchLeft" then
					flag3 = false
					commitDamage(part)
					flag4 = true
					message = ""
				else
					flag4 = true
				end
			end)
		end 
			
	elseif flag2 == 1 then
		flag2 = 0
		flag = 0
		animation2:Play()
		if flag4 then
			char["Right Arm"].Touched:Connect(function(part)
				if part.Parent.Humanoid and message == "PunchLeft" then
					flag4 = false
					commitDamage(part)
					flag3 = true 
					message = ""
					
				else
					flag3 = true
				end
			end) 
		end
	end
	wait(0.5)
end) 

If you are connecting the .Touched event more than once, it will do more damage. You should detect this.

You should add a debounce for it.

Sorry for the question but can you explain how to detect

What you could do is add a debounce.
here is an example

local Debounce = false

YourPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if Debounce == false then
Debounce = true
-- Do what you want with the script
task.wait(1) -- Cooldown
Debounce = false
end
end
end)