Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My plugin isn't functioning as intended?

Okay so, when I press the newScriptButton3 and newScriptButton2 It does nothing but when I press newScriptButton It puts all the scripts in the workspace

Problem: It isn't separated... All the buttons have their own functions. But the functions are working but not separated and not intended to be in "newScriptButton"

Code:

local Workspace1 = game:GetService("Workspace")
 
local ChangeHistoryService = game:GetService("ChangeHistoryService")
 
local toolbar = plugin:CreateToolbar("Insert empty script")
local toolbar2 = plugin:CreateToolbar("Insert empty local script")
local toolbar3 = plugin:CreateToolbar("Insert empty module script")

local newScriptButton = toolbar:CreateButton("Insert empty script", "Inserts an empty script", "rbxassetid://2609397568")

local newScript2Button = toolbar2:CreateButton("Insert empty module script", "Inserts an empty module script", "rbxassetid://150921915")

local newScript3Button = toolbar3:CreateButton("Insert empty local script", "Inserts an empty local script", "rbxassetid://411719627")

newScriptButton.Click:Connect(function()
	newScript2Button.Click:Connect(function()
		newScript3Button.Click:Connect(function()
		end)	
	end)

	local newScript = Instance.new("Script")
	local newScript2 = Instance.new("LocalScript")
	local newScript3 = Instance.new("ModuleScript")
	newScript.Source = ""
	newScript2.Source = ""
	newScript3.Source = ""
	newScript.Parent = Workspace1
	newScript2.Parent = Workspace1
	newScript3.Parent = Workspace1

	ChangeHistoryService:SetWaypoint("Added new empty script")
	ChangeHistoryService:SetWayPoint("Added new empty Local script")
	ChangeHistoryService:SetWayPoint("Added new empty module script")
 end)

3 comments

0

There is that blue button in editor, when you click it creates a block, write code inside of it, it will be formatted well, this icon btw is icon of Lua programming language which is what Roblox's language is based offf.

0

I edited it sorry.

0

ahh yess be sorry for your bad behavior for rest of your life beg for forgiveness and regret what have you done? no >wO

1 answer

Every function starts and ends somewhere, end is the end and function() is the beginning, your both functions for other 2 buttons are ending right away, and all code is ran inside of the first button, you want to do this:

newScriptButton.Click:Connect(function()
	local newScript = Instance.new("Script")
	newScript.Source = ""
	newScript.Parent = Workspace1

	ChangeHistoryService:SetWaypoint("Added new empty script")
end) -- Here "Click.Connect" ends

newScript2Button.Click:Connect(function()
	local newScript2 = Instance.new("LocalScript")
	newScript2.Parent = Workspace1
	newScript2.Source = ""

	ChangeHistoryService:SetWayPoint("Added new empty Local script")
end) -- Here second "Click.Connect" ends

newScript3Button.Click:Connect(function()
	local newScript3 = Instance.new("ModuleScript")
	newScript3.Source = ""
	newScript3.Parent = Workspace1

	ChangeHistoryService:SetWayPoint("Added new empty module script")
end)

I also think that naming workspace as Workspace1 is unacceptable, you should rethink your behavior and come up with a solution which is simple, remove the 1 from it >:v

1 comment

0

lol, love that last part

This discussion is preserved as it was. New answers, comments, and votes are closed.