Plugin Question (script.Source)

Instead of writing to script .Source
my script is a script, that I saved as a plugin with this code, it’s supposed to clone it’s child to serverScriptService

		local ChangeHistoryService = game:GetService("ChangeHistoryService")

local toolbar = plugin:CreateToolbar("Match Settings")

			local newScriptButton = toolbar:CreateButton("Create Settings Script", "Inserts a match settings script ", "rbxassetid://4458901886")

		local function onNewScriptButtonClicked()
			local newScript = script.Match_Settings:Clone()

		newScript.Parent = game:GetService("ServerScriptService")

		ChangeHistoryService:SetWaypoint("Added new empty script")

	end
	newScriptButton.Click:Connect(onNewScriptButtonClicked)

Why is it not possible to do this, and what is an alternative ?

Error :

image

1 Like

I’m having trouble understanding your question, the code you’ve provided doesn’t show you using script.Source. Are you referring to Players_required_to_start_round?


Why is it not possible to do this, and what is an alternative ? - From what I understand from your code, you’re attempting to clone a script you have in the plugin, and then setting the parent to ServerScriptService. The code should work.


I suggest that you add more information about whats causing this problem. Does it not work? Are there errors being outputted?

2 Likes

Are you sure Players_required_to_start_round is inside the script? Is there any error ouput?

When you save it as local plugin, make sure the file type is not lua but rbxm.

1 Like

apologies for not fully describing my issue earlier,

Directory :

image

The error i’m getting :

image

Also I do not have the option to save it as an Rbxm file, is that necessary though ?

-I did not change my script yet.

On line 3 it shows this :

image

Roblox Studio has a weird quirk where if the plugin itself is a script, then Roblox Studio will save the plugin as a .lua script file instead of a normal .rbmx file, which strips out any child objects the plugin has.

To counter this, group the plugin script into a model and then save that model as a plugin.

See this post for some background:

1 Like
  • plugin will normally show a warning for some reason, despite it not being depricated.
  • You will need a button ( local button = toolbar:CreateButton(title, description, id) ) for the plugin to work (assuming you’ve already done this)

Also I do not have the option to save it as an Rbxm file, is that necessary though ?

In my opinion, saving plugins as rbxm is better than just saving them as lua. Normally placing the script inside a folder and then saving it as a local plugin fixes this issue.


I have also re-written your plugin, if you’re facing any bugs, then this file should fix it.
Plugin.rbxmx (2.0 KB)

2 Likes

I didn’t know that, but that should be fixed , it confuses players and is probably a bug,

That was really helpful , anyone wanting to create a plugin but prevented from doing so as the file converts to Lua instead ,should know this , really helpful.

2 Likes