So i'm trying to save the content of a folder that is inside the local player.
This is the script that i made, but the content is not saving. and i have spend well over 3 hours looking for a solution.
Script:
local DataStoraService = game:GetService("DataStoreService")
local DataStore = DataStoraService:GetDataStore("OwnedVehicles")
--// Creating Folder
game.Players.PlayerAdded:Connect(function(Player)
local Owned_Vehicles = Instance.new("Folder", Player)
Owned_Vehicles.Name = "Owned_Vehicles"
--// Getting Conetent of Folder
local FolderContent = Owned_Vehicles:GetChildren()
--// Loading Data
local Data = DataStore:GetAsync(Player.UserId)
if Data then
FolderContent = Data.Owned_Vehicles
end
end)
--// Saving Data
game.Players.PlayerRemoving:Connect(function(Player)
DataStore:GetAsync(Player.UserId,{
["FolderContent"] = Player.Owned_Vehicles
})
end)
