Infinity Symbol Becomes ? when changing text from a script

Hello, everyone!

I’ve noticed an issue recently where the ∞ will become a “?” for some reason and I’m not sure why, as it had worked just a couple months ago. It’s quite annoying because I want the Infinity symbol to show up when you have a weapon with infinite ammo (in this case, the plasma pistol. However, recently, it’s begun to not display properly and I’m not sure how to fix it.

Code:

script.Parent.HUD.AMMO.AmmoLabel.Text = "∞"

It should be noted that putting the ∞ in the script turns it into a ? and I’m not sure why.

I can’t seem to repro this, I first put “∞” into a SurfaceGui TextLabel, that worked fine, then tried running your code from the command line, and the TextLabel showed “∞”, then tried running a server script, and the TextLabel showed “∞”. I even saved the place and re-opened it, the “∞” in the script was not a ?, and it still worked on the TextLabel.

I’m not sure what you mean by ‘will become a ?’, but if you mean in the script editor, and not the TextLabel itself, this is likely due to your font not having an infinity symbol, not due to a Roblox bug.

I’m using ArialBold as my script font.

What’s the default script font?

But yeah, if you put the infinity symbol into a script, it becomes a question mark, which then makes the ammo label become a question mark.

You can try using this in your code:

script.Parent.HUD.AMMO.AmmoLabel.Text = utf8.char(8734)

It literally just writes the “∞” symbol to the text label by taking the unicode decimal value 8734 (character value U+221E) and converting it to a character.

You can read more about the utf8 function here: https://developer.roblox.com/articles/Lua-Libraries/utf8

3 Likes

Can you provide exact steps to reproduce this? There should be no case where that happens. I’m not able to reproduce it locally as you’ve described.

How are you inputting the symbol? Are you pasting it in, typing it with an alt code, or using a special keyboard layout or IME?

Is there anything else we should know about your PC, like what language it’s set to, what OS you’re using, and so on.

By your description, it sounds like immediately upon typing it into the script editor it becomes a ? instead of the symbol. Nothing to do with TextLabels specifically. Is this right?

1 Like

Yes, I am pasting it into the script.

If I paste the infinity symbol into the text label, it renders perfectly fine.

The moment i paste it into the script, exit the script, and re-open it, the infinity symbol becomes a question mark.
I’ll see if I can get a reproduce for you.

I’m running Windows 10 Home, 64 Bit. It’s set in English, etc. etc.

Is this an issue with a unicode setting in Studio perhaps?

Here’s something interesting:

It doesn’t bug out if the script is local - however, if it’s a linked source, that’s when the bug occurs.

EDIT:
This would explain why ever since I transitioned my framework from Embedded to Linked Source, caused the ? to appear while the Embedded script still retained the ∞.

1 Like

I’m able to reproduce the issue, this is definitely a bug with linked scripts. I’ve filed it so that the right team can look at it.

2 Likes

Thank you, @Tiffblocks :slight_smile:

Should I mark this thread as answered or wait until the issue is resolved?

Move to Studio Bugs and leave unsolved

2 Likes

Moved it there.

Thanks. :slight_smile:

This also happens when saving scripts to .lua files with studio.

1 Like

I’m able to repro that case as well. I also noticed that plugins loaded from a .lua file will load with the same issue, but rbxm/rbxmx shouldn’t be affected.

1 Like

Here’s something else:

It also affects Emojis.

I think it affects anything that’s not directly on your keyboard.

Yeah, it’s a bug where all non-ASCII characters are being stripped out when you open/close a linked script.

1 Like

Is there a workaround for this temporarily?

i.e. what @Reshiram110 suggested for the Infinity symbol.
I’m not sure what the utf8 character would be, or if it even exists for the emojis.

What I suggested can work as a temporary workaround, yes.

print(utf8.codepoint("😎")) --> 128526
print(utf8.char(128526)) --> 😎
1 Like