How to indirectly store a variable

So, the below script works without error, doing every thing I need it to the first time. However, there is an issue that I face when using the same event again. This is with the variable current_pos that acts as an elevator through the conversation in replicated storage. Whenever I change current_pos I change it into the previous current_pos. Which means I cant travel down the same pathway again. How can I store the current_pos in a way that does not change the previous current_pos.

game:GetService("ReplicatedStorage").Speak.OnClientEvent:Connect(function(speaking,convo_name)
	sh.Parent.Current_Character.Image = speaking.Head.Face.Texture
	rh.Current_Character.Image = content
	player.Character.Humanoid.WalkSpeed = 0
	-- start  
	local container = {}
	local current_pos 
	current_pos = game:GetService("ReplicatedStorage").Conversations:FindFirstChild(convo_name)
	print(current_pos.Parent)
	local a = rh.Response_Handler.Changed:Connect(function()
		if rh.Response_Handler.Value == false then
			if #current_pos:GetChildren() > 0 then
				for i, v in pairs(rh:GetChildren()) do
					if v:IsA("TextButton") then 
						if current_pos:FindFirstChild(v.Name) then
							v.Text = current_pos:FindFirstChild(v.Name).Value
							local connect = v.MouseButton1Click:Connect(function()
								current_pos = current_pos:FindFirstChild(v.Name)
								rh.Response_Handler.Value = true
								rh.Visible = false
								sh.Parent.Visible = true
							end)
							table.insert(container,connect)
						else
							v.Text = "No option"
						end
					end
				end
				repeat wait() until rh.Response_Handler.Value == true
				for i = 1,#container do
					container[i]:Disconnect()
				end
				rh.Visible = false
				sh.Parent.Visible = true
			else
				print("No options")
				for i = 1,#container do
					container[i]:Disconnect()
				end
				sh.Parent.Visible = false
				rh.Visible = false
				game:GetService("ReplicatedStorage").Silence:FireServer(current_pos.Value)
				player.Character.Humanoid.WalkSpeed = 16
			end
		else
			sh.Parent.Visible = true
			sh.Text = ""
			wait(0.25)
			if current_pos ~= nil and current_pos:FindFirstChild("Response") then
				local new_text = split(current_pos.Response.Value)
				for i, v in pairs(new_text) do
					sh.Text = sh.Text..v
					wait(1/#new_text)
				end
				wait(1)
				current_pos = current_pos.Response
				wait(2)
				sh.Text = ""
				sh.Parent.Visible = false
				rh.Visible = true
				rh.Response_Handler.Value = false
			else
				print("No response")
				print(current_pos.Value)
				for i = 1,#container do
					container[i]:Disconnect()
				end
				rh.Visible = false
				sh.Visible = false
				game:GetService("ReplicatedStorage").Silence:FireServer(current_pos.Value)
			end
		end
	end)
	rh.Response_Handler.Value = true
end)
	


Just do

local current_pos = game:GetService("ReplicatedStorage").Conversations:FindFirstChild(convo_name)

when defining it

I feel like I made it too complicated. Ill make the issue more readable.

current_pos = An object
to get reponse, current_pos = current_pos.reponse

I have therefore changed An object into current_pos.reponse. This means I cant traverse the conversation again, because response will be something different.

This does not fix the issue, sorry.

Sorry, but I still don’t quite understand your issue.

When I store current_pos as an object, if I set current_pos to its child (to get the child for later use). Whenever I access the current_pos again from replicated storage, the objects will have changed.

So what is your issue here? Are you trying to use that same variable for other uses? You should be using separate variables instead of mixing different uses into one variable to avoid conflicts and confusions in scripting.

The issue here is that I need to use the current_pos variable every time. As there is no other way to continue searching downwards for the new object (which then becomes the current_pos). Picture it like an Elevator that moves down a tree like structure. I need to use the elevator(current_pos) to move down a floor. but when I move down a floor, the floor I just left turns into the floor I am visiting.

So? Why not use another variable for that? I don’t get it.

How would I implement another variable to store the next conversation piece when I dont know how many lines there will be. I have a decent idea though, I can use a dictionary. Thankyou

For anyone that wanted the solution to the problem, the function is made multiple times which means it will fire far too many times, causing erros.