Help with TD original name script

so, I have a part in my upgrade script, where it sees if it has an original tower value, if so it makes the name to that. but, it errors out “attempt to index nil with ‘Name’”.

		local ogTower = config.OriginalTower
		if ogTower then
			gui.Selection.TName.TowerName.Text = ogTower.Value.Name --here error
			gui.Selection.TName.TowerName.Text = selectedTower.Name

basically, ogTower.Value doesn’t exist. without more script, we don’t know what’s wrong, we need more evidences

basically, if its an upgrade, it should make the tower Name text the Name of the ogTower. It is an objectValue.

try to print ogTower.Value to see what’s printing

In order to help, we need more parts from the script, at least the ogTower value or config table. And seeing the output would be useful to fix.

its printing out nil even though that the upgrade still has the ogTower value.

Screenshot 2023-09-17 182647
Screenshot 2023-09-17 182825

the ogTower.Value is still in the workspace when it prints? it doesn’t get deleted?

OH! good point! when it upgrades, it gets rid of the original tower.

Then you will need to re assign the value

it just needs to be a string value instead, and itll work just fine.

if you have the solution, do not forget to flag it. This way, if someone else need the same solution, he will be able to see it

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