ok so im writing a script to open a gate when i say a specific thing in chat . problem is , when i say the thing , the gate opens but never stops . ive tried everything that i know from ifs to while ___ do loops . heres the script

local debounce = true
local part = script.Parent
local confirmation = false
local leftPartDoor = game.Workspace.leftPartDoor
local rightPartDoor = game.Workspace.rightpartDoor
local leftPrimaryPart = leftPartDoor.PrimaryPart
local rightPrimaryPart = rightPartDoor.PrimaryPart
local leftoriginalCFrame = leftPartDoor:GetPrimaryPartCFrame()
local rightoriginalCFrame = rightPartDoor:GetPrimaryPartCFrame()
local seconds = 0
local debounce2 = true

part.Touched:Connect(function(whoTouch)
	if whoTouch.Parent:FindFirstChild("Humanoid") and debounce == true then
		debounce = false
		confirmation = true
		wait(5)
		confirmation = false
		debounce = true
	end
end)

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if msg == "pee pee poo poo" and confirmation == true and debounce2 == true then
			debounce2 = false
			repeat
				wait()
				leftPartDoor:SetPrimaryPartCFrame(leftPrimaryPart.CFrame * CFrame.new(0, 0, 0.1))
				rightPartDoor:SetPrimaryPartCFrame(rightPrimaryPart.CFrame * CFrame.new(0, 0, 0.1))
				seconds = seconds + 0.1
			until seconds == 10
			debounce2 = true
		end
	end)
end)

so like , whats wrong with it ? especially this part .

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if msg == "pee pee poo poo" and confirmation == true and debounce2 == true then
			debounce2 = false
			repeat
				wait()
				leftPartDoor:SetPrimaryPartCFrame(leftPrimaryPart.CFrame * CFrame.new(0, 0, 0.1))
				rightPartDoor:SetPrimaryPartCFrame(rightPrimaryPart.CFrame * CFrame.new(0, 0, 0.1))
				seconds = seconds + 0.1
			until seconds == 10
			debounce2 = true
		end
	end)
end)