Attempt to index nil with 'Row-nan(ind)'

Sins yesterday roblox studio update i keep getting
ReplicatedStorage.Libary.Terrain:20: attempt to index nil with ‘Row-nan(ind)’
like 50-70% of the time i don’t know what to do i tried waiting a bit longer before i run the script

all i can find on the internet is that somthing about it means the computer can’t calculate the formula or somthing

ReplicatedStorage.Libary.Terrain:20: attempt to index nil with ‘Row-nan(ind)’

i basicly have 2 functions in a modulescipt inside replicated storage
one converts a vector3 value to a grid vector3 for my chunkloader
chunks are 200x200x200
will return,-200,600)

lib is the module in replicated storage

getChunk returns the folder from workspace chunks named “Col200|Row-200|Index600” ← (XYZ)

local TempLocationToCheck = lib.PositionToChunkGrid(Triangle.Position)
local ChunkFolder = lib.Terrain["GetChunk"](TempLocationToCheck)

Chunks = {
    ["Col200"] = {
        ["Row-200"] = {
            ["Index600"] = {INSTANCEChunkFolderInWorkspace,INTamountofPartsInChunk}
Terrain.GetChunk = function(InputPosition)
    return Chunks["Col"..InputPosition.X]["Row"..InputPosition.Z]["Index"..InputPosition.Y]

the script that calls the functions is called from a SCRIPT from ServerScriptService

any ideas what could cause / fix it
Thx in advance

Your error means your code is trying to run something equivalent to


Your GetChunk function should probably handle the case where the InputPosition is invalid: I see a “nan” which generally means at some point you run something like 1/0 or something else invalid which results in a vector with values that are NaN (not a number).

The problem is with the inputted InputPosition. You can either add code to handle cases where the InputPosition is invalid or make sure the InputPosition is valid before inputting it.

1 Like

i honestly don’t know cause the scenario is theoretical imposible to occur and now its gone again ill see when it comes back i honestly think its a bug cause if i do


it wil print

or somthink like it which cant if
InputPosition is nil in the first place so has to be somthing else buggy in roblox

i din’t touch that code also so it apeared and dissapeared automaticly sins yesterdays studio update
also only happens in studio no matter if i load the script instantly or deltayed / slower

but ill keep it in mind if it comes back and try to fix it then thanks for info will use it

they print


1 Like