Ok, so I made a code and I get a error saying it can’t save the data here is my code:
local DSS = game:GetService(‘DataStoreService’)
local DS = DSS:GetDataStore(‘PlayerData’)
Players = game:GetService(“Players”)
Players.PlayerAdded:Connect(function(Plr)
local Plot = Players.LocalPlayer.Plot
local success, err = pcall(function()
local data = DS:GetAsync(Plr.UserId)
end)
if success then Plot.Value = data[1]
else print(“No data…”)
end
end)
local function Save(Plr)
local DataToSave = { Plr.Plot.Value; }
local success, err = pcall(function()
DS:SetAsync(Plr.UserId, DataToSave)
end)
if not success then
warn(‘Could not save the data’)
end
end
game:BindToClose(function()
for _, Player in pairs(game.Players:GetPlayers()) do
local success, err = pcall(function()
Save(Player)
end)
if success then
print(“Data has been saved”)
else
print(“Data has not been saved!”)
end
end
end)
game.ReplicatedStorage.Events.SetPlot.OnServerEvent:Connect(function(Player, Plot, P)
P.Plot.Value = Plot
Plot.Owner.Value = P
end)
the semi colon will not affect the compilation of the code as it can be used as a seperator of values in a table, it also wont have an effect if placed at the end of an expression i.e declaring a variable [ abc = 2; ]
You can do it multiple ways. One way you can do it is you can loop through the plot and save each part / models name and position, and then in server storage or replicated storage when you want to load the plot you can pull the models / parts from it and set their position
Instances can be saved inside datastores through a process called serialization basically you have to convert every property and value of the instance(and its children) into an array, and save the array or the string(using HttpService:JSONEncode(array)) to the datastore.
To deserialize the data you have to reverse the algorithm serializing it.