[Urgent] task.spawn() does not exit simulation context; causes core scripts to error (server authority only)

Before, when scripts needed to use a property, script, or function that wasn’t allowed in a simulation callback they used task.spawn() to break the simulation context and access the needed data, but after updating to version 739, this behaviour was changed, which not only broke many of our systems but also caused default Roblox scripts to error.

For example, this part of the default AvatarAbilitiesInterface script errors on an empty baseplate with SAuth turned on:

if FFlagUserPlayerScriptsPlayerControlState then
            task.spawn(function()
                self._characterAddedConnection = player.CharacterAdded:Connect(function(character)
                    self:_onCharacterAdded(character)
                end)
            end)

task.spawn was used to access player.CharacterAdded, which isn’t allowed inside simulation callbacks, but now it errors on player join.

Expected behavior

Using task.spawn() exits the simulation context and lets scripts access data that otherwise can’t be accessed inside simulation callbacks.

Temporary workaround is to use task.defer() instead

Hey, thanks for the report. The switch to blocking task.spawn() is intentional (and task.defer() is the best alternative), but the Avatar Abilities library will need to be updated to use task.defer(). I’m going to roll back the switch tomorrow until AA can be updated, after which it will become permanent.

FYI, AA has been fixed and the flag has been rolled out!