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

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I was gonna make my pistol better before I got this error

  2. What is the issue? Include screenshots / videos if possible!
    The issue is that the script errors everytime i start playing, it says: " [Unexpected Unicode character: U+2028. Did you mean ’ '?]
    It errors at line 125

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried searching the dev forum and it’s supposedly a line format issue when you press enter, it was a brickcolor so first I tried changing the quotes from " " to ’ ', but that didn’t work, then I tried searching dev forum and retyped the line, didn’t work

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local bullet = Instance.new("Part")
bullet.Name = "Bullet"
bullet.Parent = workspace
bullet.Anchored = true
bullet.CanCollide = false
bullet.BrickColor = BrickColor.new("Institutional white") -- Line 125, where the error occurs

This issue just randomly occurred and is very annoying

any help is appreciated! :slight_smile:

5 Likes

Retype the line it maybe got some weird characters in it.

1 Like

I am also getting this error in all of my scripts. Variables don’t show up in autocomplete and autoindent doesn’t work either.

I have already checked my studio settings…

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