Service Creator is a 2 part package. The first is the plugin and the second is the Module you can use the module without the plugin but it does make it easier with the plugin. It uses custom methods for instances to work so big shoutout to @Mega_Hypex .
Now before anyone asks I know using _G is bad practice but it was the only way I could think of making it easily accessible anywhere.
How to use:
Installing:
First thing you want to do is get the plugin and module which are linked at the top then put the module anywhere you want however server storage is recommended
Creating Services:
Making with plugin:
To create a service with a plugin what you need to do is open it up then press create.
Oh and if you don’t have the module installed then it will warn you in the output
Making with Module:
So to start the module all you need to do is require(--path to module):Start() and with that it can be access anywhere on a server script with _G.Servicer. So now to actually create it just do _G.Servicer:CreateService(--Name of Service, --Module script that service runs) and now the service is running.
Using the Service
So if you haven’t already what you want to do is start it by doing require(--path to module):Start() then it can be accessed anywhere on a server script with _G.Servicer.
Then to get it just do _G.Servicer:GetService(--Service name") it can also call normal services like players.
Pros and Cons:
Pros:
Easy to access
Allows you to have more choice of how you game runs
Easy to use
Cons:
Could be exploitable (I have yet to test this)
Uses _G which is bad practice
Coding the module scripts can be confusing
The End
All right that’s it I think. If you have any feedback or questions please put them below as this is my first time making a proper module and plugin. Hope you enjoyed it and if you would make me very happy if you could heart it.
You can use ModuleScripts for making it accessible anywhere, require() is useable anywhere, in server and client, _G has race conditions and backdoors
your account isn’t ID verified, so it’s hard to find your plugin by the toolbox as roblox recently changed the way it works because people were putting inappropriate models inside boxes to bypass moderation, and roblox states that non id-verified users are most likely posting malicious content, but the source code is safe (you didn’t make a github repository and I use betteroblox extension so I can see the source coce)
I know but if I have a module say 5 folders deep it’s just a pain trying to get everything whereas with this its like a roblox service and easier to get to.
If that’s the case you have an organization problem, accessing everything in a global environment is 1000x worse, no types, easy to overwrite, and prone to race conditions.
“For every use of _G, a baby zebra dies” - Sleitnick, Creator of Knit
If you want to do it similar to the way roblox does it then make your own game class:
type ServicesIndex = "TesterService" | "PrintService"
local MyGame = {}
function MyGame:GetService(serviceName: ServicesIndex)
return require(PathToServices[serviceName])
end
return MyGame
This is still not ideal, as you have to define every service in the service index type after you create it, and I’m pretty sure you won’t get types for the service you get, but its a slightly better solution. I would still recommend using plain ModuleScripts though.