Tonumber()/tostring() Returning Errors on M2 Mac Devices

I’ve received a report that a player using an M2 Mac is experiencing a completely broken game experience due to core game mechanics not functioning properly (e.g., diving, closing garages, loading quest progress).

It turns out that tonumber(nil) and tostring(nil) trigger errors on his device, whereas they do not on mobile devices, PCs, consoles, or any other platforms. This issue hasn’t been widely reported, and the player also has the old Roblox Topbar UI. While using tonumber(nil)/tostring(nil) might be considered bad practice, it has always worked without issues until now, and there have been no recent announcements on the DevForum about changes that could affect this behavior.

There is also one weird CoreGui WaitForChild:

Let me show you the code snippets that caused errors on his device (I have permission to use those pictures):
It is sorted like this: Error, Code Snippet, My Fix

1:



grafik

2:



3:


grafik
grafik

Expected behavior

tostring(nil) and tonumber(nil) should return “nil” and nil respectively on M2 Mac devices, instead of causing errors.

3 Likes

Note: It worked for him before but suddenly broke without any apparent reason, so there might have been a Roblox API change that caused this.

1 Like

Probably because they are running an outdated Roblox version

2 Likes

That might be it, as I’ve tracked only 5 errors related to this issue in the past 30 days, even though we have around 3 million monthly users. I just wonder how they are able to enter Roblox with an outdated version.

1 Like

Maybe their device doesn’t support newer versions? Idk :person_shrugging:

1 Like

Where exactly did you get the idea that they are on an old version?
If you are basing that off of the top bar being “old”, which top bar do you mean?

Most people still have this top bar:
image

1 Like

All people actually have the old topbar as the A/B test/experiment has ended for the new one

It’s a wild guess but have you tried doing tonumber((data)) (mind the extra parentheses around the argument)? To me this doesn’t look like an issue of tonumber/tostring but instead an issue of GetAttribute returning nothing (which is not nil, confusingly).

It should work as a temporary fix as (f()) forces f() to evaluate to 1 value (nil) even if it returns nothing.

I can confirm it happening to only 1 person, there seem to be around 5 incidents of this in the Error report, so it could actually be 2-3 people of 3 million having this (so a 1/1,000,000 - 1/3,000,000) issue

And yea you are onto something, I only get this when I don’t input any variable into tostring() or tonumber() even thought :GetAttribute should only return nil if there is no attribute, which makes this even more confusing

This is just an acknowledgment announcement!

We’ve filed a ticket into our internal database for this issue, and we will update you when we have further information!

Thanks for the report!

We tried to reproduce the bug but couldn’t. Please provide more details or steps for us to continue investigating this issue.

1 Like

Hi, it seems to affect/ have affected 1 in 1 - 10+ million users (extremely rare), so I can’t provide any further details than what I’ve presented, just that this occured on an M2 Mac. I just reported this occurrence as it seemed like a weird bug. I also don’t know if this bug is still present for the affected user. I could reach out to him.