Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Does anyone know how to save something without datastore? Saving a folder

Asked by 5 years ago

So i want to save everyones money so i can so who has the most money? But that needs to be in a folder? Does anyone know method to save it and i can view it in edit? Without datastore if not i will leave this solved

1 answer

Log in to vote
2
Answered by
mattscy 3725 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

What you have to do is loop through all of the values inside the folder, and save the value of each one in a table.

local function CompileSaveData(Plr)
    local SaveData = {}
    for _,Data in pairs(Plr.FolderHere:GetChildren()) do
        SaveData[Data.Name] = Data.Value
    end
    return SaveData
end

If you gave that example function the player, it would return a dictionary with every value name as their keys, and their values as the values' value (woah thats a lot of values)

Then, you would datastore that table (similarly to how I explain here). When the player joins, you can load this data and re-create all the values with something like this:

local function CreateValues(Plr,SaveData)
    for Name,Value in pairs(SaveData) do
        Plr.FolderName:WaitForChild(Name).Value = Value
    end
end

When you give this function a player along with the loaded data, it will go through the data and re-enter every saved value into the values in their folder. You will have to change the FolderName to the appropriate name in both the examples (such as 'leaderstats' if the values are part of the leaderboard).

Hope this helps!

0
But i want to see it in-studio so i can see when someone cheated money? MaxDev_BE 55 — 5y
0
Then save the values in ServerStorage User#19524 175 — 5y
0
But how? MaxDev_BE 55 — 5y
0
You should design your system so that it is impossible to cheat money. Checking everyone's money manually is a ridiculous idea. mattscy 3725 — 5y
View all comments (2 more)
0
Like a lemit MaxDev_BE 55 — 5y
0
More like validating every coin someone earns on the server before saving it to ensure that they are allowed to earn it in the situation they are in. More detail here: http://robloxdev.com/articles/Game-Security mattscy 3725 — 5y
Ad

Answer this question