Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED] Setting TextBox.Text to a string automatically adds a "fake space"?

Asked by
LeHelary 142
5 years ago
Edited 5 years ago

So, I want this script to set the Text property of the TextBox to a string called command, and then move the cursor to the end of the string.

local command = CommandName.Text
CommandBar.Text = command
CommandBar.CursorPosition = 100000

Very easy right? Well, the problem is.. it adds the string correctly, but it also adds a "space" after it. This wouldn't be a problem for me but the thing is that other scripts do NOT recognize that "space" as a normal space (like " ") and I need to delete that space everytime. I don't understand what's the problem.

(check comments)

0
(The string **command** has no spaces) To explain it a little better, instead of setting the text to "text" it sets it to "text " and that space at the end is not recognized as a normal space LeHelary 142 — 5y
0
this is what happens if I try to print the "fake space" http://prntscr.com/qc5jxf LeHelary 142 — 5y
0
That print is pretty weird! I've never seen anything like that. I wonder if its something other than a space? can you print the length of the string? string.len(string) Kroniso 20 — 5y
0
same thing happens http://prntscr.com/qc5o0a LeHelary 142 — 5y
View all comments (2 more)
0
Could be a NBSP but I have no idea why that would be there. Try putting "command" instead of command Benbebop 1049 — 5y
0
After looking at the screenshots you have a "U+0010 : LINE FEED [LF]" or in other words a new line character in the output. This should be fixed by writing "command" instead of command. Benbebop 1049 — 5y

1 answer

Log in to vote
0
Answered by
LeHelary 142
5 years ago
Edited 5 years ago

I found the solution: Basically I press the "enter" key to insert the command, and that "fake space" was actually a new line character. That character is inserted AFTER the script changes the text value, so I added a "wait()" and now it works. Thank you @Benbebop for helping me find the solution

0
You should rename the title to "[SOLVED] Setting TextBox.Text to a string automatically adds a "fake space"?" So that it says its solved Benbebop 1049 — 5y
Ad

Answer this question