Type error even after checking if type isn't nil (new solver)


The second loop has the type error inferring it with the type Model? even though it was cleared to be a Model before. I already check if “closestChanger” is nil beforehand, so it doesn’t error for the first loop, however it does so for subsequent loops.


The type inference changing back to Model? seems to only happen after using the variable in a loop,


otherwise it works fine.


It seems to work properly if closestChanger isn’t set in an if statement though.

Place file:
Place1.rbxl (62.5 KB)

Expected behavior

I expect that there should be no type error.

Hello! Yep, agreed, definitely looks like a bug to me. We’ll try to keep you in the loop as we figure out the right fix here.

Hello! We’ve recently rolled out a fix here, the place file you provide now shows no errors for the script in ServerScriptService. Please let us know if this issue is still occurring!