What datastore does Loomian Legacy use? / What's a good way to save tons of data?

Hey!
I’d like someone to explain this to me in depth. I’d love to learn how to save a lot of data. Thanks!

EDIT: I mean, what’s a good way to save data for one item? (Example, a loomian. Like their IV’s, EV’s, health, etc.)

I’m confused, do you need to know a method for saving data or do you need a Datastore module (such as Datastore 2)?

I think he want to get the explain how DataStore work

It’s probably a table representing each item, so for pets maybe something like:

{
    {
        Id = 12,
        Name = "Fluffy",
        Level = 6,
        Health = 79,
        Colour = "FF9900",
    },
    {
        Id = 7,
        Name = "Rover",
        Level = 19,
        Health = 12,
        Colour = "FAFAFA",
    },
}

And then a folder in ReplicatedStorage with each pet’s model corresponding to the ID.

2 Likes

How can I save a ton of data? that’s my question

Save how ? Save in the server or save in such a way that even when the time is reached in another server the information is still there? There are plenty of ways to save data with no real limit (except lag sometime)

Personally, I use normal datastore and save an array. Here’s my current module that isn’t quite finished.

local Encrypt = require(game.ServerStorage:WaitForChild("Modules"):WaitForChild("Encryption"))

local Module = {}

local Loads = {}

local S = require(game.ReplicatedStorage.Services)

local Datastore = game:GetService("DataStoreService"):GetDataStore("3464574587")

Module.StarterValue = {
	Coins = 0; -- Amount of coins
	HighScore = 0; -- Amount of gems
}

Module.Load = function(Player)
	local Data

	local function Get()
		return pcall(function()
			if Datastore:GetAsync(Encrypt.Encrypt(Player.UserId)) ~= nil then
				Data = S.HTTP:JSONDecode(Datastore:GetAsync(Encrypt.Encrypt(Player.UserId)))
			else
				Data = {}
			end
		end)
	end

	local Success, Failure = Get()

	if not Success then
		repeat
			warn("Datastore load failed: " .. Failure)
			wait(5)
			Success, Failure = Get()
		until Success
	else
		print("Datastore load was successful")
	end

	for Name, Value in pairs(Module.StarterValue) do
		if not Data[Name] then Data[Name] = Value end
	end

	Loads[Player.UserId] = Data

	return Data
end

Module.Save = function(Player, Data)
	local OldData = Module.Load(Player)--Loads[Player.UserId]  broken for some reason

	local ShouldSave = false

	for DataName, _ in pairs(Module.StarterValue) do
		if OldData[DataName] and Data[DataName] then
			if type(OldData[DataName]) == "table" then
				if #OldData[DataName] ~= #Data[DataName] then
					ShouldSave = true break
				else
					for I, Value in pairs(OldData[DataName]) do
						if Value ~= Data[DataName][I] then
							ShouldSave = true
						end
					end
				end
			else
				if OldData[DataName] ~= Data[DataName] then
					ShouldSave = true break
				end
			end
		else
			ShouldSave = true break		
		end
	end
	
	local Success, Failure
	
	print("Request to save " ..  tostring(Player.Name) .. ", request was " .. tostring(ShouldSave))
	
	if ShouldSave then
		local function Do()
			return pcall(function()
				Datastore:SetAsync(Encrypt.Encrypt(Player.UserId), S.HTTP:JSONEncode(Data))
			end)
		end

		Success, Failure = Do()

		if not Success then
			repeat
				warn("Datastore load failed: " .. Failure)
				wait(5)
				Success, Failure = Do()
			until Success
		end
	end
	
	return Success or false
end


return Module

Note that this isn’t the most efficient way, but it works.

1 Like

Why are you encrypting data keys, this won’t increase security in any way.

I’m just a little bit extra, yk? Also, if someone can somehow gain serverside access to the game they wont be able to change anyone’s datastore because they don’t know the key.

If they have server side access they can just call your encrypt function on a players UserId to get the encrypted ID.

I’m just curious on how loomian legacy saves 7 loomians (And all of them in your pc) so when you come back there still there? Just a normal datastore wouldn’t be good for saving so much data. I’d assume they use tables, but I don’t know how to datastore a table?

You just call UpdateAsync like usual, I don’t get what you’re confused about.

You can just save a table like anything else, however I would recommend using a module such as Datastore 2 or ProfileService to store data as they have both been proven to be reliable and they store backups of players data.

Alright, thank you! I didn’t realize it was so simple!

They’re only able to do that if you have LoadStringEnabled on ServerScriptService.

Do what? Serverside access can be gained through backdoors.

Ehhh… depends on your game. But specifically when you have a remote event that messes around with data stores. LoadStringEnabled is not recommended, as it’s basically letting clients actually send code to the server, instead of being a pre made function using a remote event. As long as you keep it off, you’re not gonna have a problem with that. Don’t worry.

I have a bit of experience in the field of exploiting serverside access comes from, and I know for a fact that if you can get the key to save your datastore you can edit your datastore. Doesn’t matter what boxes you have checked. I use encryption as a way of attempting to slow down serverside exploiters in the event that someone gains access.

I’m confused? How? I’ve never heard that before. Do you have experience somewhere else or in Roblox? Roblox works in different ways from most stuff. Because of Filtering Enabled.

The way serversides work is when somehow someone gets a script into your game (this could be through a model that you use) they can give themselves essentially the power of the command bar. They can excecute any code they want on the server. Which is why you must be careful when using models etc. I just use encryption as a precaution.