I am currently developing a plugin that could benefit from communication between its Edit Mode and Run Mode versions.
Since there hasn’t been much discussion on this, I was wondering if anyone knows of a way to achieve cross DataModel plugin communication?
This was the only lead I’ve found, which itself dates back to 2020. Also, it appears that the functions mentioned are no longer available to plugins, as their security level has been reverted to RobloxScriptSecurity…
I’m not aware of any API that specifically intends to serve as communication between plugin instances created in different environments. Here’s a few methods you could try depending on what sort of communication you need exactly between a “studio edit mode” plugin and a “studio run mode” plugin:
Creating instance hierarchies somewhere in the data model (ex. ServerStorage)
Using plugin setting APIs, plugin:SetSetting() and plugin:GetSetting()
Some form of communication over localhost using HttpService
The _G variable is shared between plugins, you could use that to maybe store references to bindable events to send data across plugins. I would advise caution with this since you cannot control the order plugin’s load, so it may cause some racing conditions, but I’m sure that with some clever trick and maybe a module loader you could set it up.
Standalones dont even work for user plugins anymore. Support for that was dropped a while ago.
I think I should explain which how plugins work when it comes to contexts. Fundamentally, Studio can summon up to 4 different instances of your plugin in different spaces, these being
Standalone - the standalone context (start page etc.), not currently usable by user plugins.
Edit - edit mode when the game isn’t running, I’m unsure if starting a game pauses execution of this plugin
Server/Client (seperate contexts) - when a game is actually running
The APIs for this are actually SetItem, GetItem and OnSetItem. One thing you need to be aware of is that DataModels are memory isolated, this meaning you cant send Instances across the ocean, so if these APIs do ever get unlocked again, keep that in mind.
There’s also MultipleDocumentInterfaceInstance which is solely meant for the standalone datamodel, and tells you when new DataModels are created or destroyed. This is also currently only usable by Roblox-created plugins.
I guess you could use settings but theres no event logic for that, and edit plugins dont get restarted, only suspended. this was wrong lol.