How would I make a plugin with clonetroopers opensource code?

  1. What do you want to achieve? I want to make a plugin wit h clone troopers code

  2. What is the issue? I’m not sure how to make a plugin or where to put the scripts

  3. What solutions have you tried so far? I have looked on the dev forum
    here is the code from github

Intro to Plugins - this is a good place to start. It suggests managing your plugin code in a Script located in the ServerScriptService of a blank place, however I typically prefer putting a Script (typically named “PluginScript” within a Folder (named whatever your plugin is going to be named) inside ServerStorage – this way the code will not run if you need to locally test within the place). You can use cloneTroopers code by manually copy and pasting it into a script or more likely ModuleScript which is also parented to either your plugin Script or the Folder (if you prefer the setup like I described). Remember that when programming plugins, all calls to require() should use relative paths [example: local MyMod = require(script.Parent.ModuleScript)].

2 Likes

Do I put all the code in one script or do I make multiple scripts?

SamplePluginSetup
This is pretty much what my typical setup looks like. PluginScript is the main, or driver, script which Roblox will recognize and run first (I believe there used to be a strict naming convention associated to this, however I think this has since been changed - I still recommend having only one Script at the highest level of your plugin Folder). You can put any models, GUIs (I sometimes make a separate folder for these), or other assets needed by your plugin in the Assets Folder. ModuleA and ModuleB can be any sort of module that your main plugin might require, you can also have modules at the top-most level of the plugin Folder as is the case with ModuleOther. One note on multiple scripts and modules existing within a plugin however: Only the main or driver script (PluginScript in this case) will have immediate access to the keyword plugin as a reference to the Plugin object it represents. There are ways around this such as passing the reference as an argument to an initiator function of other modules scripts or storing its reference somewhere accessible to all modules. If you want (or works better/is easier for you to manage currently) have all your code inside just a single Script – in my example the PluginScript.

2 Likes

is this correct?
image

Yes, that absolutely can work. By the way, the Assets Folder, ModuleA, and ModuleB aren’t required by any means, they were simply an example of how you might set up the hierarchy of a plugin.

Placement of modulescripts, assets, other objects depends on where you desire to keep them. Better to use a placement system you understand well, all you need to learn is how to access these objects and use them in your code.

1 Like