Enabling/Disabling a Plugin UI

So I’m making this plugin, originally was going to do it dockable widget, but I decided there isn’t much of a point to that with it only having a few functions.

Anyways, I’m trying to get my UI to be visible, but I can’t get it.

I’ve done UI:Clone().Parent = game.CoreGui but either I did it wrong or it just didn’t work.

Also should I be using a LocalScript or a ServerScript?

1 Like

Plugins don’t really have a concept of server/client since it’s in Studio, so just use a standard ‘server’ script.

As for the UI, make sure it’s an actual ScreenGui object. And don’t clone it, because then you’re just taking up more memory by creating a duplicate. Simply reset its parent to the CoreGui. Here’s an example below:

local ui = script.MyPluginScreenGui -- Whatever you called it
ui.Parent = game:GetService("CoreGui")

Then you can toggle it on/off using the Enabled property of the ScreenGui.

8 Likes

Thank you very much!! I’ve got it working.

I was trying to use a Frame vs a ScreenGui.

Thanks again!

1 Like

This is my personal preference, but I think despite the amount of functions you should use a plugin gui. It looks nicer as it fits in with the rest of the studio widgets, not some UI standing out in the 3D viewport. Your call. :smiley:

1 Like

I plan on making another version of this (like a 2.0) that has much more to it, and it’ll be a dockable widget. :slight_smile: )

Just for this one it’s more of my “test plugin” just so I can get the hang of stuff.

2 Likes

I understand.

1 Like