Today, our game is experiencing a lot of bugs with systems we’ve never had to edit in the past few years. Specifically, we have a BoolValue object under a Script with the name “Enabled”.
Currently, when attempting to get the value associated with this BoolValue, we get an error stating “Attempt to index boolean with Value” using Script.Enabled.Value
It appears that this issue only occurs when you have a child living under a script with the name “Enabled”. This has not been an issue in the past and has only started happening today it seems.
Even checking the Properties for the Script object, there is no “Enabled” Property. Please can someone at Roblox revert whatever change was made so our game can still function.
I expect that .Enabled will reference my BoolValue
Actual Behavior
An Error, “Attempt to index boolean with Value” due to a hidden Property of a Script called “Enabled”
Workaround
Not unless I go through our entire codebase to account for this sudden, unannounced change.
Issue Area: Engine Issue Type: Other Impact: High Frequency: Constantly Date First Experienced: 2022-08-30 00:08:00 (+01:00) Date Last Experienced: 2022-08-30 00:08:00 (+01:00)
This issue was caused by the latest version which was rolled out to servers today, not yet to clients and studio. The new version adds a Script.Enabled property that we were not expecting would cause an issue like this. We’re looking into this issue and what we can do.
In the mean time, it’s possible to work around this issue by replacing usages of .Enabled.Value with :FindFirstChild("Enabled").Value.
No offence, but I feel like major changes like this (Enabled is a common word used for some instance names, at least especially for me) should be communicated before the update rolls out.
This is why I encourage accessing children through Instance:FindFirstChild exclusively. You don’t need to pay attention to announcements about new properties, you don’t need to consider likelihood a given name will ever be used as a property, and you don’t need to care about consistency. If more developers did this, it would help Roblox iterate faster.
I’d definitely like to see some convenient shorthand for only accessing a child sometime.
This doesn’t matter. The actual performance concern with accessing a child is that the cost scales linearly with the number of children. Ideally you’re storing references to children instead of repeatedly indexing them, and using a dictionary where you need to optimize dynamic references to children in hot code.
For an object with 10,000 children, this is a comparison of one child access. An equivalent map lookup would take under 1 μs.