I'm not sure if it's a bug or I made mistakes.
Does the issue occur in the editor or during gameplay?
If it's a gameplay issue, please specify which movement system and camera type you're using (free movement vs. grid movement, third-person vs. first-person) or N/A if not applicable:
Briefly describe the issue you're experiencing:
Put any command after if/then/end, I get unexpected token.

But if put if/then/end at the end of the code, no error but the result gets silly.

Are there any errors in the in-game debug console or external console window?