Loading/Saving from Roblox Studio

Loading the Module

Make sure you have generated a token and inserted the module into your game.

First, load the module in your script by requiring the module, like this:

local returnedDB = require(game.ServerStorage:WaitForChild("returnedDB_Module")

Now, create a new instance with your token by doing:

local DB = returnedDB.create("YOUR TOKEN GOES HERE")

Now, to read a value, simply do:

local example = DB:Read("KEY NAME") -- This will return it's value or nil if it doesnt exist
print(example)

And to write a value, do:

DB:Write("KEY NAME", "VALUE EXAMPLE")

The module handles error handling using pcall, so no need to intergrate it.

A full example would be:

local returnedDB = require(game.ServerStorage:WaitForChild("returnedDB_Module")
local DB = returnedDB.create("XGUFYGSUDYFGAWYEGIAYUGROE")

DB:Write("pro user", "returnedmath") -- store the value
local pro user = DB:Read("pro user") -- This will return it's value or nil if it doesnt exist
print(example) -- prints "returnedmath"

Last updated