What’s the problem?
While it’s not visible in the Studio Properties panel, the command bar and Studio plugins can set the RunContext property on LocalScripts, since the property is part of BaseScript, from which LocalScript is also descended, not part of the Script class exclusively.
Why is this a problem?
In Studio tests, Team Test, etc, LocalScripts with RunContext set to Client behave as a Script with Client RunContext would behave in the same situation (which still caused some minor confusion, as it’s not the same as the Legacy behavior for LocalScripts – see here for a similar but unrelated case).
When playing the game via the Roblox player, however, the script will not run at all, instead giving a “blank” error showing only the full name of the script. Since RunContext understandably does not display in the Studio Properties menu for LocalScripts, this creates a really problematic “phantom error” – the error is completely uninformative, the script will appear to work in Studio, and the culprit is not visible by examining the script normally.
Why did you do this?
A coworker of mine, who is not able to report this on their own behalf, ran into this issue accidentally by replacing a Script with a LocalScript using a Studio plugin which allows changing between similar classes while maintaining properties, descendants, etc. You can also reproduce this with Command Bar or a rbxm file, but I’m not sure anyone would run into this by accident without some kind of plugin.
Reproduction files (not mine):
Bug_Repro.rbxl (39.0 KB)
Expected behavior
The developer wiki states the following:
Note, RunContext cannot be used from a LocalScript.
To me this implies that RunContext on a LocalScript should do nothing even if you do set it (Legacy behavior regardless of the applied setting), and should perhaps produce a studio error when you try to change it. Making the behavior consistent between player and studio also seems important; if the preferred behavior is to throw an error at runtime, preferably change the error to something developers can act on rather than just the full name of the problem script with no further elaboration.