Hi - Right now this is my code but it doesn't seem to be working...
if tlc ~= nil then tlc.Name = tostring(tonumber(tlc.Name) + 1) end
it's in a for loop and i'm trying to make its name go up by one for example
First time entire for loop runs, name = 1 Second time, name = 2 etc... but i get this error:
Attempt to preform arithmetic on a nil value
which i sort of understand, but how can a part's Name be nil?
Sorry, my bad...
I had a part that was called something that wasn't a number and that messed everything up... So here's my solution if anyone else was having this problem:
if tonumber(part.Name) ~= nil then -- do math on name end
From the sound of things, it would appear that, "tlc" is under a index of sorts, I would suggest using :FindFirstChild()
FindFirstChild takes into account if something is nil or not, while just doing for example
workspace.Part
Up here is just a destination. ^
workspace:FindFirstChild("Part")
This is the method for checking, the difference is it finds parts, but also has the ability to see stuff, such as if it is even found while if you just put the destination without that built in function in, it will error out all the time. So when checking if a part is found, or if anything is in anywhere in your game explorer, make sure to use :FindFirstChild()