Storing plugin assets?

Hello developers!

I’m creating a UI based plugin, and I’m having some trouble working out how to store the assets that I need to use in the plugin.

For example, the main ScreenGUI element.
image

At the moment for testing purposes, I’ve just added the ScreenGui to ReplicatedStorage and that’s how I am referencing it in the script (which is a plugin)

local GUI = game.ReplicatedStorage.ScreenGui:Clone()
GUI.Parent = game.CoreGui
GUI.Enabled = false

When I tried to parent the GUI to the script, I got the error “GUI not a child of Script”. Understandable, the plugin script is stored locally not in game.

How can I store this GUI without the player being able to see it? Is creating it using code the easiest option?
Would InsertService be a good solution?

Thanks!

1 Like

You can actually just simply store the Gui inside of the script then publish the script as a plugin
image
Example ^

Then you can access it in the plugin by simply doing script.ScreenGui

3 Likes

Just a tip, when making GUI stuff for plugins it quickly gets annoying to constantly move the assets between the plugin and StarterGui so you can see what you’re doing. So I usually look for them in the script AND StarterGui, like this:

local pluginGui = pluginScript:FindFirstChild("TheGui") or game:GetService("StarterGui"):FindFirstChild("TheGui")
2 Likes

Hm I tried that and I got an error. Are you sure this works for local plugins?

… Because local plugins only saves the script, not any assets inside the script.

Idk about local plugins I personally publish my plugins and it works fine for me

Okay, I’ll store it in replicatedstorage while Im developing the plugin and when I go to publish I’ll move it inside the script.