Unexpected Unicode character: U+2028. Did you mean ' '? Why am I getting this error

This seems to be a bug with Roblox studio at the moment, same thing happened to me. Try rewriting the line or copy and pasting the code into a new script.

2 Likes

It seems like you have the Unicode line seperator in your code.

Since Roblox doesn’t properly handle this as whitespace, it errors. You can ctrl+f for the character to remove it, but the issue is a larger problem with roblox as a whole and the only real solution is to copy-paste new line (regular CR LF not the unicode) characters until it gets fixed.

2 Likes

Possibly related to Pressing Shift+Enter in the script editor will create an invalid unicode character - #8?

1 Like

I pressed space instead and the same errors popped up.

I’m having this error also, my script was working fine yesterday but now it isn’t’…

1 Like

Bumping this because this is happening to me as well, except I cannot find the character.

I have attempted to fix it by pasting my code into this Unicode-character identifier:
https://www.babelstone.co.uk/Unicode/whatisit.html

However, it didn’t show anything out of the ordinary.

I even attempted to copy and paste the U+2028 character from multiple websites, and use Ctrl + F and Ctrl + H to no avail.

These are the first two lines of my script, and Output is saying that the first line has the offending character.

I have tried to retype this many times.

local D = false
script.Parent.Touched:Connect(function(Touch)

Select that all, copy it, delete it, and repaste it.

That still didn’t work for me…
As I mentioned before, I have retyped this many times.

Odd, works for me.
Either then this ~ Error that I don't know how to fix - #9 by Forcoy I’m out of ideas.

1 Like

The only way I’m able to get this error is by pressing Shift + Enter on Windows or Shift + Return on macOS since it created an invalid unicode.

I got one burning question though. If you guys have that error constantly, what OS are you running? Do you have any additional languages installed (like if you have a language bar)?

Here’s a proper solution for you.

  1. Open Notepad (the regular one that comes with your computer)
  2. Paste the stuff giving you problems into notepad (I would just copy the whole script)
  3. Hit save and make sure you’re saving it in ASCII format.
  4. If you get any prompts warning you about unicode being lost, just hit OK and proceed.
  5. Close notepad, re-open that file
  6. The file should have no unicode whatsoever.
1 Like

It’s a roblox bug currently being investigated by the team

I researched some more, and it’s actually a problem with the line number on the left, if there is a big gap between the lines, that is where the error occurs, backspace it and the error is gonna disappear, but it happens when you press shift+enter and is very annoying

Edit: This is what im talking about:

Image

needs to get fixed

3 Likes

The way I managed to fix it is copying and pasting it into a new script, its worked every time so far by doing that.

I have the same issue. It says Unicode + 2028 Unexpected Chracter Did you mean ‘’?

1 Like

I noticed that the issue occurs when you skip the line with Shift. You can try avoiding using the Shift+Space for line skipping, just pressing Space might help you.

If you are looking for a temporary solution until Roblox fixes this bug properly, I have made a hacky plugin that solves this by automatically removing the unusual characters and creating a newline as expected when you press shift+enter, or any other key combinations that cause the same issue.

You can install the plugin here if you are interested:

(Source code: GitHub - jotslo/shift-enter-fix: A temporary solution to a bug with the Roblox Studio script editor that causes invisible unicode characters to be added when the user presses shift + enter.)

8 Likes

Thanks for creating this. Very used to using shift+enter on things like Discord so this helps a lot.

It’s a new bug in Roblox Studio, but I noticed that every time the bug occurs, there is a slight gap between the lines, like a non-number existential line.
Basically a line with no number beside it,
Screenshot by Lightshot (an example of a line without number)
and to fix that, you have to remove that line so the flow goes normally.

please do not take the picture too seriously, it is just an
illustration example since i fixed the bug in my studio

and yeah based on the above, the reason it created a line with no number
is because when skip a line using shift, we just have to be careful while Roblox tends to fix this.

1 Like

Like everyone else said, if there’s a gap inbetween lines (like in BasedKnowledge’s picture) it’s a shift+enter unicode character. Just retype the line or copy and paste the line.