Saving a Script as a Local Plugin is Broken

Right-clicking on a script–>“Save as Local Plugin” will save a broken plugin that cannot reference instances within itself. The problem stems from the fact that source containers will be saved as .lua files, not .rbxmx files like other plugins. Lua files only save the source code of that particular script, but not any descendants.

image
The .rbxm and .rbxmx files work normally, but the .lua does not

Repro.rbxm: Create a script with an instance inside of it. Attempt to reference the instance from within the script. (Or just drag the repro file into a place in Studio). Right-click the script–>“Save as Local Plugin” and observe that it saves the file as a .lua. When the plugin loads, the reference is unsuccessful, as if the instance isn’t even there.

Workarounds: Put the plugin inside of a folder or something and save the folder instead. It will save as a .rbxmx, allowing it to function as normal. Alternatively, just upload the plugin to the cloud.

It seems that this issue was first noticed in July '18 in this thread. I’m not sure if it was never fixed, or only just resurfaced.

4 Likes

Just saw this, and idk if it helps solve the problem, but once I put it in a model or folder it worked when saved as local… however, twice (once during the linked post, and once on another occasion) even when put in a model or folder it still would not work, until I published to Roblox first, then it had no more problems.

It’s kind of cool that you can save a plugin as a mere Lua script, though it’s annoying that Roblox Studio defaults to doing that when you’ve got other objects in there.