I have a combat script and a friend and I have gotten down a wait time between each combo. Only issue that we're having is that the script reads the code after the very first combo and ends up doing the first move twice, but only after you try and start the combo up again after the prior combo directly after the cooldown. How do I get rid of this issue?

local Player = game:GetService("Players").LocalPlayer

local rp = game:GetService("ReplicatedStorage")
local Combat = rp:WaitForChild("Combat")

local UIS = game:GetService("UserInputService")

local debounce = false
local cd = .5

local comboCool = false

local currTime = 0
local prevTime = 0
local count = 0

UIS.InputBegan:Connect(function(input,isTyping)
	if isTyping then
		return
	elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
		if debounce == false and comboCool == false then
			debounce = true
			currTime = tick()
			
			local passedTime = currTime - prevTime
			if passedTime < 1 then
				--Can continue the combat combo
				count = count + 1
				if count > 5 then
					comboCool = true
					print(count)
					print(comboCool)
					wait(1.75)
					count = 1
					comboCool = false
					print(count)
					print(comboCool)
				end
			else
				--Restarts the combo
				count = 1
				comboCool = false
				print(count)
				print(comboCool)
			end
			
			Combat:FireServer(count)
			
		end
	end
end)

Combat.OnClientEvent:Connect(function()
	prevTime = currTime
	
	wait(cd)
	debounce = false
end)

The wait and comboCool were an attempt to fix the issue.