Quickscriptsetup (Roblox) is a plugin that I made a while ago which will insert boilerplate code based on a script’s name.
(apologies for the quality of the video in both framerate and length)
You can create any kind of script, then rename it to one of the templates, and finally rename it again to tweak some of the script variables.
As a simple example (and the reason this script was created), you can make a ModuleScript under ReplicatedStorage, then name it “oop
” to insert the boilerplate object code into that script:
local MyClass = {}
MyClass.__index = MyClass
function MyClass.new()
local self = setmetatable({}, MyClass)
return self
end
function MyClass:Destroy()
end
return MyClass
to achieve this code, all you need to do is name the script you made “oop”, then rename it to “MyClass”.
Even longer templates are supported too, including “oopi
”/"oopd
" for object inheritance:
local Parent = require(script.Parent)
local MySubclass = {}
MySubclass.__index = MySubclass
setmetatable(Parent, MySubclass)
function MySubclass.new()
local self = MySubclass.new()
setmetatable(self, MySubclass)
return self
end
return MySubclass
Some other boilerplates to further entice you:
- Script + LocalScript
- services (define various services)
- remote (code for both types of remotes)
- require (define a module with a require)
- Script specific
- none
- LocalScript specific
- gui (code for a button click)
and for ModuleScripts,
- init (runs a function then returns true)
- data (returns a table)
- oop (custom class template)
- oopd and oopi (class template that inherits from the script parent)
Inspired by hello_123991’s ModuleHelper (and more specifically its comment).