Creating Plugin

I want to make a plugin for myself for some future use cases and to possibly opensource that basically just speeds up building by taking pre-built structures and modifying the pre-built pieces to match a large variety of other pieces.

I have absolutely no idea where to start on making this, besides the gui, I have checked around and cant really find any use cases that help what I’m trying to do. All I know is its using some presumably pretty advanced math functions and equations.

I don’t really want code, just someone to explain whats going on and how I can attempt to replicate whats going on in @Zomebody 's plugin.

The plugin you linked doesn’t quite do what it seems to be doing. Instead of taking an example model and resizing it to fit the given target part, it generates the model from the ground up using the dimensions of the selected part. I considered trying to make the plugin as you described, where it takes an example model and resizes it, but there were a lot of technical/math problems involved which are hard to solve. For example, how would you scale stairs? Some parts would need to stretch, others would need to repeat, others would have to remain static, etc. It’s a big mess.

As for how the plugin itself works, it contains modules for each of the different models it can generate. Each of those modules contains a function where it takes the selected part and a dictionary of settings. Those settings are taken from another, separate module which gets updated when you change settings in the UI. Each function will generate and return a model to the main script which will then replace the target with said model. The code in each function is different and contains a lot of conditions to handle the given settings.

You would think that the plugin contains a lot of difficult math, but for the most part it’s relatively simple if you know your sohcahtoa, Pythagoras and basic CFrame math. For example, outlines are generated by applying a CFrame to the target part depending on the target’s size and the outline part:

OutlinePart.Size =, 0.5, Target.Size.Z)
OutlinePart.CFrame = Target.CFrame*, Target.Size.Y/2 - OutlinePart.Size.Y/2, 0)

That will place a 0.5 thick outline part at the top of the selected part. Obviously there’s a lot more going on for each model (which requires between 100 to 400 lines of code usually), but it mostly comes down to reading variables/settings to pass different if-statement and then create parts and position them by applying CFrames. There’s a lot of trial and error as well.

One day I’ll attempt to make a plugin which takes an example model and resizes it to match a target part, but that day is still far away.


Well that clears up a lot of confusion, thank you for explaining whats going on behind the scenes.