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

how do i save inserted objects in a folder?

Asked by 5 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.
local codeData = game:GetService("DataStoreService"):GetDataStore("C")

game.Players.PlayerAdded:Connect(function(plr)
    local codeFolderNames = Instance.new("Folder", game.ServerStorage.Code)
    codeFolderNames.Name = plr.Name

    local key = plr.UserId

    local savedValues = codeData:GetAsync(key)

    local gotChildren = codeFolderNames:GetChildren()

    if savedValues then
        gotChildren = savedValues[1]
    end
end)

game.Players.PlayerRemoving:Connect(function(plr)
    local key = plr.UserId
    local whatToSave = game.ServerStorage.Code:FindFirstChild(plr.Name):GetChildren()
    codeData:SetAsync(key, whatToSave)
end)

that's the code i got so far, help?

0
Explain what isn’t working Ziffixture 6913 — 5y
0
It doesn't put the objects back in the game when you play it again. Like for instance, a player inserted like a BoolValue into a folder, and basically I want it to save that object, so the player leaves (it saves) then when they join back that boolvalue is still there suphaninjap221 -9 — 5y

Answer this question