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

Method of saving a bunch of Values over datastore that isn't painful?

Asked by 7 years ago
Edited 7 years ago

I have been working on a registry system for a little OS project i've been doing for a little while now. I was wondering if there was any way to save the entire folder with all its subfolders and values quickly. I tried using SaveInstance but it seems pretty broken (and rightfully so as it's been depreciated for a while). I kinda wish they would offer an alternative to something before depreciating it, but eh, i'm not the judge.

Here's my SaveInstance code.

wait(10)
game.Players.PlayerRemoving:Connect(function(player)
print("SAVING REGISTRY FOR: " .. player.Name)
player:SaveInstance("player_registry_saved", player.PlayerGui.Main.Registry)
end

And here is the loading script...

wait(0.5)
if game:GetService("RunService"):IsStudio() then script.Disabled = true end
PLR = script.Parent.Parent.Parent.Parent.Parent
local ROOT = script.Parent.Parent.Parent
local REGISTRY = ROOT.Registry.Computer
local MAINUI = ROOT.Parent.DISP
PLR:WaitForDataReady()
local REG_SAVED = PLR:LoadInstance("player_registry_saved")
if REG_SAVED ~= nil then
    script.Parent.Parent.Parent.Registry:Destroy()
    wait()
    REG_SAVED.Parent = script.Parent.Parent.Parent
    --[[REG_SAVED.Registry.Parent = script.Parent.Parent.Parent
    wait()
    REG_SAVED:Destroy()
    wait()]]
end
wait(2)
local REGISTRY = ROOT.Registry.Computer
REGISTRY.HKEY_LOCAL_MACHINE.SYSTEM.REGISTRY_LOAD.IS_LOADED.Value = true
script.Disabled = true

If there is any way to save a bunch of values in one swipe without throttling yourself hundreds of times, it would be greatly appreciated.

0
this is not a data store this is data persistence which is deprecated. User#5423 17 — 7y
0
Yes I know, i said in the post that it was depreciated. I was wondering if there was a way to save directory trees/models over DataStore easily. The_Sink 77 — 7y

Answer this question