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)
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