Do you use local scripts or server scripts for plugin Guis?

I have never made a plugin with gui.

EDIT: You need to use server scripts for plugins as stated in @busterbob64’s reply. (This edit was for the people coming to this topic who wants the answer to what the titles says.)

EDIT: I have recently converted the team adder plugin gui to use Lua Widgets, which makes the plugin look a lot nicer.

I was working on a team adder plugin, and I couldn’t get the gui to work properly. All the scripts inside the gui never ran (They were local). So I changed them to server scripts and they still didn’t work. If you guys need all the code for the plugin, I may provide it in the replies.

Any help is appreciated!

You may need to export it as a local plugin (i don’t have much understanding of the making of it either but have made a few in the past).

image

The gui appeared on the screen, but the buttons and text scripts inside the gui elements didn’t work.

I don’t think local scripts or server scripts run in the CoreGui or the DockWidgetPluginGui, you should be handling the entire GUI (mouse clicks, etc.) in the script that parents the gui to the correct place

1 Like

Oh apparently someone already has asked this and got answered, maybe this could help:

1 Like

I’ve tried to do that, but I couldn’t get it to work. Would I do some like this:

script.Parent.TeamPluginGui.TeamFrame.CreateTeamButton.MouseButton1Click:Connect(function()

or…

game:GetService("CoreGui"):WaitForChild("TeamPluginGui").TeamFrame.CreateTeamButton.MouseButton1Click:Connect(function()

I’ve looked over that topic, and it didn’t help too much.

1 Like

Let me show you what I mean:
( this is a template obviously you need to get all the buttons to work )

local gui = script.Parent:WaitForChild("TeamPluginGui") -- assuming it's the gui
local teamFrame = gui.TeamFrame
local createTeamButton = teamFrame.CreateTeamButton

createTeamButton.MouseButton1Click:Connect(function()
	-- script here
end)

gui.Parent = game:GetService("CoreGui")
1 Like

That kind of just makes everyone more confusing, since my script looks like this, so I don’t know where to put your code in.

local ChangeHistoryService = game:GetService("ChangeHistoryService")
local enabled = false

local toolbar = plugin:CreateToolbar("Custom team adder")

local newTeamButton = toolbar:CreateButton("Create a team", "Make a team", "rbxassetid://28718513")

local function onNewTeamButtonClicked()
	enabled = not enabled
	
	if enabled then
		script.Parent.TeamPluginGui:Clone().Parent = game:GetService("CoreGui")
	else
		if game:GetService("CoreGui"):FindFirstChild("TeamPluginGui") then
			game.CoreGui.TeamPluginGui:Destroy()
		end
	end
end

newTeamButton.Click:Connect(onNewTeamButtonClicked)
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local enabled = false

local toolbar = plugin:CreateToolbar("Custom team adder")

local newTeamButton = toolbar:CreateButton("Create a team", "Make a team", "rbxassetid://28718513")

local function onNewTeamButtonClicked()
	enabled = not enabled
	
	if enabled then
		local teamPluginGui = script.Parent.TeamPluginGui:Clone()
		teamPluginGui.TeamFrame.CreateTeamButton.MouseButton1Click:Connect(function()
			-- script goes here
		end)

		teamPluginGui.Parent = game:GetService("CoreGui")
	else
		if game:GetService("CoreGui"):FindFirstChild("TeamPluginGui") then
			game.CoreGui.TeamPluginGui:Destroy()
		end
	end
end

newTeamButton.Click:Connect(onNewTeamButtonClicked)
1 Like

Oh alright! Don’t think i can help any further then but i do wish you luck as i do think @ClientCooldown has the right idea with their solution.

When I press the plugin button, nothing happens, nothing in the output, no gui, just nothing.

Pretty weird, it should be working as long as there are no errors, are you sure you are saving the local plugin correctly?

To save it correctly you have to manually select all the descendants in the folder, the folder too (it’s all in a folder right?) and then save it as a local plugin, this is weird but I had such issues

I forgot to add:

newTeamButton.Click:Connect(onNewTeamButtonClicked)

EDIT: Still doesn’t work bruh.

Are there any errors in the output?

Yes, I just noticed this:

image

EDIT: I should probably show you the hierarchy of the plugin folder:

image

Oh, try adding a WaitForChild instead of indexing it directly, and make sure you are selecting the entire plugin like this: image

not like this image

No, I fixed it, but I accidently made a new plugin instead of saving the plugin as the old one. I am getting another error, but I think I could fix it on my own, the error only appears when I press the button, which is good.

EDIT: No I was wrong, I have no idea what I did, but something happens I guess, it shouldn’t be too bad.

1 Like

I’m having trouble getting everything to work, if you know how to fix, please do so:

local ChangeHistoryService = game:GetService("ChangeHistoryService")
local enabled = false

local toolbar = plugin:CreateToolbar("Custom team adder lol")

local newTeamButton = toolbar:CreateButton("Create a team", "Make a team", "rbxassetid://28718513")

local function onNewTeamButtonClicked()
	enabled = not enabled

	if enabled then
		local teamPluginGui = script.Parent.TeamPluginGui:Clone()
		
		coroutine.wrap(function()
			while task.wait() do
				local R = tonumber(teamPluginGui:WaitForChild("TeamFrame").ColorPicker.R.Text)
				local G = tonumber(teamPluginGui:WaitForChild("TeamFrame").ColorPicker.G.Text)
				local B = tonumber(teamPluginGui:WaitForChild("TeamFrame").ColorPicker.B.Text)
				
				teamPluginGui.TeamFrame.ColorPicker.ColorShower.BackgroundColor3 = Color3.fromRGB()
			end
		end)()
		
		teamPluginGui.TeamFrame.CreateTeamButton.MouseButton1Click:Connect(function()
			local newTeam = Instance.new("Team")

			local color = BrickColor.new(teamPluginGui.TeamFrame.ColorPicker.ColorShower.BackgroundColor3)
			local name = teamPluginGui.TeamFrame.TeamNameBox.Text

			newTeam.Parent = game:GetService("Teams")
		end)

		teamPluginGui.Parent = game:GetService("CoreGui")
	else
		if game:GetService("CoreGui"):FindFirstChild("TeamPluginGui") then
			game.CoreGui.TeamPluginGui:Destroy()
		end
	end
end

newTeamButton.Click:Connect(onNewTeamButtonClicked)

What is the error in the output? I can’t really tell what to fix if I don’t know where is it