Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

6 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

0

this is what happens if I try to print the "fake space" http://prntscr.com/qc5jxf

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)

0

same thing happens http://prntscr.com/qc5o0a

0

Could be a NBSP but I have no idea why that would be there. Try putting "command" instead of command

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.

1 answer

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

1 comment

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

This discussion is preserved as it was. New answers, comments, and votes are closed.