Fixing Lua bug that your games may be relying on

From a script, you can use . and [] to access child-objects:

> print(workspace.Baseplate)
Baseplate

However, there is a bug where sometimes when you use the wrong name for an object, you are still able to get the child

> Instance.new("Frame", workspace)
> print(workspace.frame)
13:39:06.338 - "Workspace.frame" should be "Frame"
Frame

We have been tracking places that are accidentally accessing child objects with incorrect names. The number of cases is low enough that we want to move forward with fixing this bug, but it is not zero. We will be enabling the fix early in January, at which point a few scripts in a few games may break.

Until then, please take a moment to look through your gameā€™s output, looking for the distinctive warning message (ā€œXā€ should be ā€œYā€, e.g. [ā€œWorkspace.frameā€ should be ā€œFrameā€] from the example above) and fix them.

17 Likes

Does this bug exist for both . and [] or only using the period as in the example posted?

Would this mean increased performance or something?

@FearMeIAmLag:
It affects . and [], but does not affect :FindFirstChild(), :WaitForChild(), or :GetService()

> Instance.new("Frame", workspace)
> print(workspace["frame"])
15:17:11.886 - "Workspace.frame" should be "Frame"
Frame
> print(workspace:FindFirstChild("frame"))
nil
> print(workspace:WaitForChild("frame"))  -- never prints anything

@ScriptOn:
Fixing this makes way to improve performance. The bug involved checking child instances twice (which can add up if the object has many children) which will no longer happen.

This excites me as I check inside of objects veeeerry often in my games.

What kind of performance update do you think itā€™ll make way for?

Does this also affect the ā€˜game.workspaceā€™ vs ā€˜game.Workspaceā€™ ā€˜featureā€™?

@Zomebody game.workspace is a special exemption that will continue to work. Basically, if you donā€™t get the warning, your code will not break.

1 Like

workspace is a property of DataModel, ditto with Workspace.

Also lighting if you feel like being hacky and not going game:GetService(ā€œLightingā€). :wink:

Reminder: we will be enabling this soon. Please take a moment to check your game for this issue. See original post for more information.

11 Likes