So, what I am trying to do is store data for the folder. Whenever a player is exiting the game, the script will save his/her Data Folder. This script is a Server script and is the Child of ServerScriptService. The script I have written is:
local ds = game:GetService("DataStoreService") local PlayerAmianData = ds:GetDataStore("AmianData") game.Players.PlayerRemoving:Connect(function(player) local Owned_Amians = player.PlayerGui.Owned_Amians --Error for tries = 1, 10, 1 do local success, errormessage = pcall(function() PlayerAmianData:UpdateAsync(player.UserID, Owned_Amians) end) if success then break else PlayerAmianData:SetAsync(player.Name.."_"..player.UserID, Owned_Amians) break end end end)
In this script, the PlayerAmianData
is the user data. I have written another function to set the data, but I need help with this first. I'm new to Datastores and this is the best I have written. Please try to help or tell me if there is a better way to datastore a folder. Thanks!!