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.
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
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.
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
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.