How do i set the cursor position in a textbox via script?

I am making a command bar and i ran into a problem i made so when you press TAB it autocorrects to a command and just switches out the current text with the command, but when you press tab the cursor is still where you pressed tab. Example i type: “gi” and press tab it looks like this (with the cursor being the “|”): “gi|ve”. I tried setting the CursorPosition in the script but that didn’t work. Is there any workaround to this problem?


nevermind, i found the issue with it not being set