DataStore2 without the String Values?

Hello! I am trying to script the datastore part of my game and I see all these tutorials on YouTube use string values with to save data (Example: Coins, XP, etc.) and if they do it that way won’t a hacker just be able to give themselves infinite coins?

Is there a way to use datastore 2 without the string values?

Hackers cannot access your DataStore2 module if it’s placed properly. Everything in your game, that is important, must be placed in ServerScriptService or ServerStorage, hackers don’t have access to both.

So far, hackers are able to look into modules and local scripts, not at server scripts, but that can change in the future as exploits advance, make sure to keep all of your critical stuff, like DataStores2 modules at ServerScriptService, this way they are completely sealed off exploiters.

Are they able to access the string values that a data module makes for the player?

If I’m not wrong, DataStore2 has a simple check to make sure its being required by the Server. It’s a property of RunService.

Modules can be accessed from both client and server, but you can restrict access by using RunService.

Example:

local runService = game:GetService("RunService")
local isServer = runService:IsServer()

if isServer then
-- Continue code

If I’m not wrong, DataStore2 module has this check, as it’s something quite simple to make. Also, if it’s on ServerScriptService, exploiters can’t access it at all.

Oh wow, that helped understand it a little better ngl

Players.PlayerAdded:Connect(function(player)
    local pointsStore = DataStore2("points", player)

    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"

Would a player be able to change these within LocalPlayer and affect the data though? even with run service?

You see, in order to edit a module with another script, you need to require() it.

The client cannot see ServerScriptService, which means they can’t require it in the first place, therefore he can’t make any edits at all.

Plus, if the Run Service check is in place, the code would never run at all, even if the client requires the module, since the if statement wouldn’t pass.

Oooh ok! Thank you so much for your help!