On changing table value, second connected one doesnt change

Hello!
I made script that goes like this: (i simplified it for purposes of clear read-through)

local table1 = { part = workspace.part1}

local table2 = {
	name = table1.part.Name	
}

button.ClickDetector.MouseClick:Connect(function() 
	print("table2.name")
end)

and made a function that changes table1’s part scope, which looks like this:

table1["part"] = workspace.part2

problem is that when i update table1, it does update part1 to part2, but table2’s value doesn’t change with it, and name remains same. How do I update table2 with table1?

1 Like

You update table 2 by reassigning the variables (basically just doing

table2 = {
	name = table1.part.Name	
}

whenever you update table1)


Don’t have the quotation marks

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.