Hey there so recently I was kinda annoyed the fact that there could be so many things I could do if I could create my own service e.g make a npc creater service or make a tycoon service. So I looked around and found what I think would be a good way to do it. The code is pretty simple and has probably been used loads before but it uses this: Making your own methods for Instances and some _G stuff which I know is probably not the best but it is all I could think of to
make it more accessible.
Any feedback or comments is appreciated
Getting Started
So all you need to do is get the module script here and put it anywhere you like although it is recommended you put it in ServerStorage. After in any script type the line: require(path to script):Start()
right and so now it should work anywhere (apart from local scripts)
Making my own service
Right so now that you have it loaded you can call it by doing _G.Servicer
and we want to use the :CreateService()
function and it takes 2 parameters first is the name of the service and the second is a module script which we can attach to it. I’m gonna call mine Jeffrey cause why not and just use the DataStore2 module script so _G.Servicer:CreateService("Jeffrey",script.Parent.Ds2)
and there we go we now have a custom service.
Using the service
Now you maybe wondering is there a special function to get it and the answer is no. All you have to do is call _G.Servicer:GetService(service name)
and yes it does work with already in game services e.g players.
I am just going to call mine and store it as a variable so local Ds2 = _G.Servicer:GetService("Jeffrey")
and now we have the DataStore2 module in our code meaning I can call Ds2:Save()
or Ds2:Set()
although keep in mind it will not autofill which is a downside.
There maybe optimization’s and small things I could do to make it better because it is in BETA and it does not have proper anticheat to stop a hacker from accessing it but that will be coming in future updates
The End
So I hope you find this module useful and easy to use and if you have any questions please reply with them and do the same for bugs. thanks for reading
If you found this module useful donating 2 or 3 robux to this link would be very appreciated: PlsDonateLink