Could you show an example? Like I said, I’m extremely new to data saving
alright, this is how I would do it. I wrote this in a rush, but it should get you pointed in the right direction.
local datastoreservice = game:GetService("DataStoreService")
local GameData = datastoreservice:GetDataStore("Data 1")
game.Players.PlayerAdded:Connect(function(Player)
local PlrStats = Instance.new("Folder",player)
PlrStats.Name = "PlrStats"
local plrdata
local success, errormsg = pcall(function()
local plrdata = GameData:GetAsync(player.UserId)
end)
if plrdata ~= nil then
if plrdata.PlrStats then
for i, v in pairs(GameData.PlrStats) do
local value = Instance.new("StringValue")
value.Name = "Stand"
value.Parent = PlrStats
end
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local GameData = {}
GameData.PlrStats= {}
for i, v in pairs(player.PlrStats:GetChildren()) do
table.insert(GameData.PlrStats, v.Name)
print(v.Name)
end
local success, errormsg = pcall(function()
GameData:SetAsync(player.UserId,GameData)
end)
if success then
print("your data was saved")
else
print("Data didn't save")
end
end)
hey again, sorry for the late reply, i’ll try asap