Shop script error

Hey everyone! So recently, I have been working on a shop script which checks the value of the tool you’re holding and buy it accordingly. However, there seems to be a problem. The dialogue glitches and plays two statements together.

Script:

local billboardGUI = script.Parent
local talkFrame = script.Parent.TalkFrame
local talkLabel = talkFrame.text
local player = game.Players.LocalPlayer
local promptDesc = workspace.talkPrompts:GetDescendants()
local talkEvent = game.ReplicatedStorage.talkToDummy

workspace.talkPrompts.Dummy.talk:FindFirstChildOfClass("ProximityPrompt")
local function typewriter(newString : string, label : GuiObject, soundFX : Sound, slowness : number)
	for i = 1, #newString do
		label.Text = string.sub(newString, 1, i)
		soundFX:Play()

		task.wait(slowness/100)
	end
	wait(0.3)
	return Enum.TweenStatus.Completed
end

local prompt = workspace.talkPrompts.Dummy.talk:FindFirstChildOfClass("ProximityPrompt")

workspace.talkPrompts.Dummy.talk:FindFirstChildOfClass("ProximityPrompt").Triggered:Connect(function()
	local isInProcessOfBuying = false
	if player.Character:FindFirstChildOfClass("Tool") and player.Character:FindFirstChildOfClass("Tool"):FindFirstChild("storeItem") and player.Character:FindFirstChildOfClass("Tool"):FindFirstChild("isBought").Value == false and isInProcessOfBuying == false then
		local toolName = player.Character:FindFirstChildOfClass("Tool").Name
		local toolCost = player.Character:FindFirstChildOfClass("Tool"):FindFirstChild("cost").Value
		billboardGUI.Adornee = prompt.Parent.Parent:WaitForChild("CashierHead")
		talkFrame.Style = Enum.FrameStyle.ChatBlue
		isInProcessOfBuying = true
		prompt.Enabled = false
		typewriter("That '"..toolName.."' will cost you $"..toolCost..". Talk to me again to purchase.", talkLabel, game.SoundService.shopkeeper_talk, 5)
		task.wait()
		billboardGUI.Adornee = nil
		talkLabel.Text = ""
		talkFrame.Style = Enum.FrameStyle.Custom
		prompt.Enabled = true
		prompt.Triggered:Connect(function()
			local money = player:WaitForChild("moneyAmount")
			local tool = player.Character:FindFirstChildOfClass("Tool")
			if tool and money.Value >= toolCost and tool:FindFirstChild("isBought").Value == false and isInProcessOfBuying == true then
				game.ReplicatedStorage.itemsPickupValue.enableTool:FireServer()
				money.Value -= toolCost
				player.Character:FindFirstChildOfClass("Tool"):FindFirstChild("isBought").Value = true
				billboardGUI.Adornee = prompt.Parent.Parent:WaitForChild("CashierHead")
				talkFrame.Style = Enum.FrameStyle.ChatBlue
				prompt.Enabled = false
				isInProcessOfBuying = false
				player.Character:FindFirstChildOfClass("Tool"):WaitForChild("Script").Disabled = false
				typewriter("Thanks." or "Real money, huh?", talkLabel, game.SoundService.shopkeeper_talk, 5)
				task.wait()
				billboardGUI.Adornee = nil
				talkLabel.Text = ""
				talkFrame.Style = Enum.FrameStyle.Custom
				prompt.Enabled = true
			elseif player.Character:FindFirstChildOfClass("Tool") and money.Value < toolCost and player.Character:FindFirstChildOfClass("Tool"):FindFirstChild("isBought").Value == false and isInProcessOfBuying == true then
				billboardGUI.Adornee = prompt.Parent.Parent:WaitForChild("CashierHead")
				talkFrame.Style = Enum.FrameStyle.ChatBlue
				prompt.Enabled = false
				typewriter("That isn't enough cash.", talkLabel, game.SoundService.shopkeeper_talk, 5)
				task.wait()
				billboardGUI.Adornee = nil
				talkLabel.Text = ""
				talkFrame.Style = Enum.FrameStyle.Custom
				prompt.Enabled = true
				wait(1)
				isInProcessOfBuying = false
			end
			prompt.Triggered:Connect(function()
				if player.Character:FindFirstChildOfClass("Tool")  and player.Character:FindFirstChildOfClass("Tool"):FindFirstChild("storeItem") and player.Character:FindFirstChildOfClass("Tool"):FindFirstChild("isBought").Value == true and isInProcessOfBuying == false then
					local toolName = player.Character:FindFirstChildOfClass("Tool").Name
					local toolCost = player.Character:FindFirstChildOfClass("Tool"):FindFirstChild("cost").Value
					billboardGUI.Adornee = prompt.Parent.Parent:WaitForChild("CashierHead")
					talkFrame.Style = Enum.FrameStyle.ChatBlue
					prompt.Enabled = false
					typewriter("You've already bought those "..toolName.." for $"..toolCost..".", talkLabel, game.SoundService.shopkeeper_talk, 5)
					task.wait()
					billboardGUI.Adornee = nil
					talkLabel.Text = ""
					talkFrame.Style = Enum.FrameStyle.Custom
					prompt.Enabled = true
				end
			end)
		end)
	elseif player.Character:FindFirstChildOfClass("Tool") and not player.Character:FindFirstChildOfClass("Tool"):FindFirstChild("storeItem") then
		billboardGUI.Adornee = prompt.Parent.Parent:WaitForChild("CashierHead")
		talkFrame.Style = Enum.FrameStyle.ChatBlue
		prompt.Enabled = false
		isInProcessOfBuying = false
		typewriter("That's not a store item you're holding.", talkLabel, game.SoundService.shopkeeper_talk, 5)
		task.wait()
		billboardGUI.Adornee = nil
		talkLabel.Text = ""
		talkFrame.Style = Enum.FrameStyle.Custom
		prompt.Enabled = true
	elseif not  player.Character:FindFirstChildOfClass("Tool") then
		billboardGUI.Adornee = prompt.Parent.Parent:WaitForChild("CashierHead")
		talkFrame.Style = Enum.FrameStyle.ChatBlue
		prompt.Enabled = false
		isInProcessOfBuying = false
		typewriter("You don't have anything with you.", talkLabel, game.SoundService.shopkeeper_talk, 5)
		task.wait()
		billboardGUI.Adornee = nil
		talkLabel.Text = ""
		talkFrame.Style = Enum.FrameStyle.Custom
		prompt.Enabled = true
	end
end)

Note: The statements typewriter("That '"..toolName.."' will cost you $"..toolCost..". Talk to me again to purchase.", talkLabel, game.SoundService.shopkeeper_talk, 5) and typewriter("That isn't enough cash.", talkLabel, game.SoundService.shopkeeper_talk, 5) are the statements that play together, when it SHOULD only play the latter.

Please help!