I did some experimenting and I was able to find the cause of this issue. If you set a variable with the structure x = if y then z else w, you can do that within itself, like this
the line setting the primarypart causes the issue. it also messes with studio formatting so that auto-formatting the document will indent everything after that line.
Hi, thank you for filing this ticket. This is a known issue with our formatter and we’re in the process of collecting feedback for similar issues under this thread.
Please let us know if you have any similar issues under that thread.