Roblox Studio lua have some bug

https://gyazo.com/e21e5c063643807898312bff368d78fa
I tried rightclick then its create “end” but its wrong , the last is correct

It’s not a bug. You just forgot to close the second if statement (The very long one)in your code.