GoodGuy21938
(NobodyInParticular)
September 17, 2023, 8:02am
#1
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
else
gui.Selection.TName.TowerName.Text = selectedTower.Name
end
Boustifail
(Boustifail)
September 17, 2023, 8:18am
#2
basically, ogTower.Value doesn’t exist. without more script, we don’t know what’s wrong, we need more evidences
GoodGuy21938
(NobodyInParticular)
September 17, 2023, 8:21am
#3
basically, if its an upgrade, it should make the tower Name text the Name of the ogTower. It is an objectValue.
Boustifail
(Boustifail)
September 17, 2023, 8:21am
#4
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.
GoodGuy21938
(NobodyInParticular)
September 17, 2023, 8:24am
#6
its printing out nil even though that the upgrade still has the ogTower value.
Boustifail
(Boustifail)
September 17, 2023, 8:28am
#8
the ogTower.Value is still in the workspace when it prints? it doesn’t get deleted?
GoodGuy21938
(NobodyInParticular)
September 17, 2023, 8:29am
#9
OH! good point! when it upgrades, it gets rid of the original tower.
Boustifail
(Boustifail)
September 17, 2023, 8:30am
#10
Then you will need to re assign the value
GoodGuy21938
(NobodyInParticular)
September 17, 2023, 8:30am
#11
it just needs to be a string value instead, and itll work just fine.
Boustifail
(Boustifail)
September 17, 2023, 8:32am
#12
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
system
(system)
Closed
October 1, 2023, 8:33am
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.