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.
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.