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

How do i script a plugin so when the button is pressed it will make a part?

Here is what i have tried

PluginManager()
    :CreatePlugin()
        :CreateToolbar("Make new part plugin")
            :CreateButton(
                 "Make new part",
                 "Click this button to make a part",
                 "IconName.png"
            ).Click:connect(function()
                  game.Instance = game.Instance.new("Part", workspace)
            end)

1 answer

✓ Accepted answer

I'm not familiar with plugins. However, I did notice some errors on line 9.

First, you should not make your variable game.Instance. On top of that, Instance is not a child of game. It is a base class for all objects in game hierarchy. Here's how a part should be created:

local part = Instance.new("Part",workspace)

I hope i helped!

2 comments

0

Thanks but i don't know why local is in front of it.

0

Local variables are more efficient that global variables, so you should use that whenever you can.

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