Script:DisableService()

I am making a game where people can execute their own scripts, both client sided and server sided. The game will only be for mobile and have 1 player servers.

The game I am making utilizes the DataStoreService to make saves of not only their scripts, but everything they’ve done too. The problem is, people can get the DataStoreService and possibly clear everyone’s saves.

I have thought of checking if the script includes DataStoreService, but then I instantly realized that people can do this:

local a = "ta"
local e = "Sto"
local b = "Da"
local c = "vice"
local d = "Mess"
local g = "agi"
local f = "reSer"

local z = game:GetService(b..a..e..f..c) -- Da ta Sto reSer vice - DataStoreService

This would be fixed if a staff member comes in and adds DisableService() and EnableService(), I just can’t yet post in Engine Features. The function can only be called on the server, and finally, the usage would be:

workspace.Script:DisableService("DataStoreService")
workspace.Script:EnableService("DataStoreService")
workspace.Script:GetServiceEnabled("DataStoreService")
2 Likes

Script execution is a very niche case, and I don’t think it’s needed to add the ability to enable and disable services for specific scripts. I’d recommend working on a sandboxing system that wraps these services through the environment and prevents the scripts from doing harm to saved data.

1 Like

I am quite good at coding, yet I still don’t understand some things that you said, such as a sandboxing system, and I wouldn’t want to spend a whole lot of my time coding something just to prevent a script from getting a service. And I hope that stuff doesn’t include getfenv() and metatables, since I still don’t understand those.

Unfortunately, sandboxing includes a lot of environment modification (getfenv and setfenv) and metatables.

Oh. Now I guess I need to spend even more time watching tutorials if I want to go to the sandboxing side.

May not wanna rely solely on tutorials, it’s a lot more efficient (and usually unbiased :stuck_out_tongue: ) to absorb documentation relating to what you need to do.

I seem to fail learning getfenv() with the DevForum, an actual tutorial video helps me a lot and I use those for almost everything.

Why not name the datastore something extremely confusing and random? Like a password?

Also can’t the script itself just do

script:EnableService("DataStoreService")

A script quickly names the DataStoreService something fully random almost every time, but smart people (mostly just everyone) can still just use :GetService(). And a script other than the executor script will disable the DataStoreService for it. The function can’t just be called on itself when it has a disabled service.

No, I’m talking about something like this

DataStore:GetAsync("jirpdvtyigxhwjojtayatfvkijkaytlhykoypbzzxmwpgphswi")

There’s no way that the server can identify which player that belongs to. I also don’t know any ways to encrypt a string on the go.

Oh, sorry, I ment DataStore:GetDataStore()

1 Like

Oh right, I can simply just add a DataStore with a very long and hard name. I now feel dumb for not remembering how data stores work.

1 Like

Lol, when i say ‘documentation’ i don’t mean ‘community forum’. Things like the API Hub and it’s tutorials, as well as the Lua 5.1 manual especially are great sources. And if you feel like googling 15 terms, the luaU github docs are a good place too