How can I make those texts independent from the part?

Hello, I have this code:

local debounce = false
local textQueue = {"First Text", "Second Text", "Third Text"} 
local currentIndex = 1
local waitTime = 5 
local function displayNextText(player)
	local playergui = player:WaitForChild("PlayerGui")
	local textbox = playergui.PopUp2.Text
	textbox.Text = textQueue[currentIndex]
	textbox.Fade:FireClient(player)
	currentIndex = currentIndex % #textQueue + 1
end

local function startTextDisplay()
	while true do
		wait(waitTime)
		for _, player in ipairs(game.Players:GetPlayers()) do
			displayNextText(player)
		end
	end
end

script.Parent.Touched:Connect(function(hit)
	if not debounce then
		debounce = true
		if hit.Parent:FindFirstChild("Humanoid") then
			local character = hit.Parent
			local player = game.Players:GetPlayerFromCharacter(character)
			if player then
				displayNextText(player)
				spawn(startTextDisplay)
			end
		end
		debounce = false
	end
end)

The bahvior I’m looking to achieve is that when the player touches the part once, the texts start showing up even if I don’t touch the part, and the texts show only once.

Currently, the issue I’m having is that the text continously show up when I touch the part and they depend on the part.

How can I fix this?

To make it shared between all parts have a small script in each part that fires an Event which connected to your current Touched function. Then the debounce will be shared between all parts that can send the event.
DisplayNextText just needs a way of telling the caller that this was the last piece of text. You could do that by returning false and using that as the condition of your while loop