Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My plugin isn't functioning as intended?

Asked by 2 years ago
Edited 2 years ago

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)
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. imKirda 4491 — 2y
0
I edited it sorry. Pro_beatz 36 — 2y
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 imKirda 4491 — 2y

1 answer

Log in to vote
0
Answered by
imKirda 4491 Moderation Voter Community Moderator
2 years ago

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

0
lol, love that last part AProgrammR 398 — 2y
Ad

Answer this question