So in my script, I call seperateCFrame
and it ends up giving me an error on the loop because it's trying to find the length of a nil object (cfrm) thinking its a string. When I do a print test on it I find that before I call the function it prints fine, but as soon as I call it the parameter turns nil. Why is that?
function seperateCFrame(cfrm) print(cfrm) -- Prints nil local localSeperator = "," local element = "" local newCFrame = {} for i = 1,string.len(cfrm) do -- Error trying to get len of nil value -- Other stuff... local data = serverdata for i,v in pairs(data) do print("Test: "..v," | ",v[3]) -- Prints everything fine local cframe = seperateCFrame(v[3]) -- Other stuff...
Sorry about this facepalm, but v
is actually a string value, which is why v[3]
was nil. I got confused by the print because I used the same symbol to separate data in the string as I did to separate the output of v
and v[3]
.