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

Plugin not working, explanation on how to fix please?

Asked by 8 years ago

I have no idea why, but this isn't working, error is:

13:04:49.543 - Argument 3 missing or nil 13:04:49.545 - Script 'Plugin_266184626.Welder', Line 21 13:04:49.547 - Stack End Code:

function weld(group) -- just a function to weld stuff
    local x=1
    while x==1 do
        for _,i in pairs (group:GetChildren()) do
            if x==1 then
                x = 0
                basePiece = i
            end
        end
    end
        for _,v in pairs(group:GetChildren()) do
                    local w = Instance.new("Weld")
                    w.Name = ("%s_Weld"):format(v.Name)
                    w.Part0,w.Part1 = basePiece, v
                    w.C0 = basePiece.CFrame:inverse()
                    w.C1 = v.CFrame:inverse()
                    w.Parent = basePiece
                    print(w.Part1 .." has been welded to: ".. w.Part0)
    end
end
local toolbar = plugin:CreateToolbar("Welder") --here is line 21, also known as the error line
print("Plugin has been loaded")
local button = toolbar:CreateButton("Weld tool","Press me to weld your stuff", "http://www.roblox.com/asset/?id=266188619") --pretty sure the right asset5 id, otherwise the 19 at the end is a 20
print("Welding V2 Has loaded. Please, to use this correctly, activate the plugin, select your stuff, then click the right mouse button.")
button.Click:connect(function()
    plugin:Activate(true) 
end)

-- Setup mouse
local mouse = plugin:GetMouse()
mouse.Button2Down:connect(function() 
    weld(game.Selection:Get())
end)

This is my first time writing my own plugin, my others I just converted someone else script to a plugin. Which was once before because I found it helpful. Anyway, can anyone explain what I did wrong?

0
Also, on the wiki, it says "plugin" is now a global variable, so I am assuming it is representing itself, like how in a normal script, it is calling itself, "script" rollercoaster57 65 — 8y

Answer this question