Best way to make clashing? (Quick Time Event)

I want to know what would be the best way to make a quick time event based clashing system.

Here’s how my current clash system works:

Player initiates clash with another player

Pause with a random wait (0.3 - 0.7 seconds for added suspense)

Key to press is shown on screen. (the letter is w, a, s, or d)

Both players tap it as fast as possible

Player with the fastest time wins the clash and engagement.

How would I put this into code? I already have a somewhat functioning system that does this, but I feel that it could easily be improved and would like more insight from other people.

My code so far:

-- ModuleScript (clash initiated)

local CamRig = game.ReplicatedStorage.Assets.HumanoidCameraRig:Clone()
		CamRig.Parent = workspace
		CamRig.RootPart.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(3,0,0) * CFrame.Angles(0,45,0)
		game.Debris:AddItem(CamRig,4)
		
		player.Character.Humanoid.AutoRotate = false
		
		enemy.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-3.5)
		enemy:SetPrimaryPartCFrame(CFrame.lookAt(enemy.HumanoidRootPart.Position, player.Character.HumanoidRootPart.Position * Vector3.new(1,0,1) + enemy.HumanoidRootPart.Position * Vector3.new(0,1,0)))
		
		game.ReplicatedStorage.Assets.CameraEffectsModule.FireCamFocus:FireClient(player,CamRig.Humanoid)
		coroutine.wrap(function()
			task.wait(3)
			game.ReplicatedStorage.Assets.CameraEffectsModule.FireCamFocus:FireClient(player,player.Character.Humanoid)
		end)()
		AnimationModule.playAnimation(CamRig,RS.Animations.Clash.ClashCamera)
		AnimationModule.playAnimation(player.Character,RS.Animations.Clash.Clash1)
		AnimationModule.playAnimation(enemy,RS.Animations.Clash.Clash2)
		task.wait(0.1)
		coroutine.wrap(function()
			game.ReplicatedStorage.Assets.CameraEffectsModule.FireCameraShake:FireClient(player,8,20,CamRig.Humanoid,0.1)
			AnimationModule.playAnimation(player.Character,RS.Animations.Clash.ClashLoop1)
			AnimationModule.playAnimation(enemy,RS.Animations.Clash.ClashLoop2)
			coroutine.wrap(function()
				task.wait(decimalRandom(0.3,0.7))
				RS.Remotes.ClashRemote:FireClient(player,"Clash","player1")
			end)()
			task.wait(2.5)
			player.Character.Humanoid.AutoRotate = true
			AnimationModule.stopAnimation(player.Character,"ClashLoop1")
			AnimationModule.stopAnimation(enemy,"ClashLoop2")
		end)()

--CLIENT

Clash.OnClientEvent:Connect(function(Action,playerNumber)
	if Action == "Clash" then
		if not started then
			script.Parent.Visible = true
			randomletter = getRandomLetter()
			StartTime = os.clock()
			started = true
		end
		local function TimeSinceStart()
			return os.clock() - StartTime
		end
		script.Parent.TextLabel.Text = randomletter
		conn = UIS.InputBegan:Connect(function(Input)
			if Input.KeyCode == Enum.KeyCode[randomletter] then
				Clash:FireServer(playerNumber,"None","ClashReceive",TimeSinceStart())
				script.Parent.Visible = false
				started = false
				conn:Disconnect()
			end
		end)
	end
end)

--SERVER RECEIVE

if Action == "ClashReceive" then
		
		local part = Instance.new("Part")
		part.Name = "DISPLAYPART"
		part.Parent = workspace
		part.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(2,0,-1)
		part.CanCollide = false
		part.Transparency = 0.8
		game.Debris:AddItem(part,2)
		
		if player1 == "player1" then
			
			print("Player 1's Time = "..tostring(Time))
			
			local player1value = Instance.new("IntValue")
			player1value.Name = "Player1Time"
			player1value.Value = Time
			player1value.Parent = part
			
			game.Debris:AddItem(player1value,2)
			
		elseif player2 == "player2" then
			
			print("Player 2's Time = "..tostring(Time))
			
			local player2value = Instance.new("IntValue")
			player2value.Name = "Player2Time"
			player2value.Value = Time
			player2value.Parent = part

			game.Debris:AddItem(player2value,2)
		end
		
		if part:FindFirstChild("Player1Time") then
			if part:FindFirstChild("Player2Time") ~= nil then
				if part:FindFirstChild("Player1Time") < part:FindFirstChild("Player2Time") then
					print("Player 1 has won the clash!")
				elseif part:FindFirstChild("Player1Time") > part:FindFirstChild("Player2Time") then
					print("Player 2 has won the clash!")
				end
			else
				print("Player 1 has won the clash!")
				
			end
		end
		
	end

Well nobody can improve a system without first seeing the code (if that’s what you want to be improved), unless you mean the mechanics, which (to me) seem solid.

There is a lot that seems inefficient to me. Was going to edit the post today in order to include the code.

I finally updated the post to show my code. Any suggestions?