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

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

Asked by 10 years ago

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

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

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!

0
Thanks but i don't know why local is in front of it. iluvmaths1123 198 — 10y
0
Local variables are more efficient that global variables, so you should use that whenever you can. Perci1 4988 — 10y
Ad

Answer this question