Detect If Plugin Is Running Locally

This might be a stupid question, but how would you detect (programmatically) if the current plugin script is running as a local plugin rather than one installed from the Library?

I am just curious, why do you need this?

Debugging. If the plugin is local, print the debug messages. If not, don’t. It’s quite annoying when plugins print logging messages to the output.

Well, if you are the only user to have the plugin local to debug, then you can use Studio Service and get the user ID

Unfortunately, that won’t work. :GetUserId() will work regardless of the plugin status. I need something that will produce different outputs based on whether the plugin is local to not.

Tested with:

  • Local: My local plugin
  • Published: InCommand

The thing is, you will be the only one with the debug right? So that means you can check if the userid is from you. Correct me if I am wrong, and if I am please give more detail

1 Like

I’m not trying to make it permission-based. I’m just trying to make it output the debug messages if the plugin resides in the local plugins folder rather than being a published plugin.

In any place, GetUserId will return the same thing (assuming I’m the only one in Studio) regardless of whether the plugin is running local or published.

I see what you’re saying, that I should whitelist the output logs to myself only. However, I don’t want to see outputs from my plugin once I publish it.

I guess the only solution would be to use this in conjunction with the placeId since I develop all my plugins in one specific place.

Let me try something, I will give an updated once I am done

Didn’t work, yes I think there is no way

1 Like

Couldn’t you use RunService:IsServer() or RunService:IsClient()?

Nope, both return true in both scopes.

Correct me if I’m wrong, but you can only create a plugin with a ServerScript, so it’s only on the server.

Roblox Plugins have server scripts run locally, they act like a local script. So LocalPlayer is a thing as long as teamwork is enabled

I tested this, it returns true regardless. I would encourage you to test it yourself if you don’t believe me.

I think I misread the question. You want to check if the plugin is a file on the users’ computer, but not published?

2 Likes

May I ask what you’re using this for?

Yes, I want to check if the plugin is a non-published plugin vs a published plugin in the Library.

I’m not sure this is possible. There might be an API for it, but I’m not sure. The best workaround I can come up with is add a setting for that in the UI.

You can check for “.rbxm” in the plugin name (some plugins are .rbxm, some are .rbxmx when saved).

local IsLocal: boolean = if string.find(plugin.Name, ".rbxm") then true else false
2 Likes

I completely forgot about names, I’ll test it out later today.