Hey guys, I have a question.
local function setupPlayerData(player)
local data = DataStore1:GetAsync(player.UserId)
if not data then
data = {Items = {}, Money = 0, Experience = 0}
DataStore1:SetAsync(player.UserId, sessionData[player])
end
sessionData[player] = data
end
game.Players.PlayerAdded:connect(setupPlayerData)
local function savePlayerData(player, playerItems)
for i, v in ipairs(workspace[player.Name].itemHolder) do
sessionData[player].Items[v.Name] = {
CFrameValues = {v:GetPrimaryPartCFrame().X, v:GetPrimaryPartCFrame().Y, v:GetPrimaryPartCFrame().Z, v:GetPrimaryPartCFrame():toEulerAnglesXYZ()}
}
end
DataStore1:SetAsync(player.UserId, sessionData[player])
end
I have a three by three grid that saves every sixty seconds (or, one minute.) Once the game saves twice with a part unmoved, on the next game join, will there be three parts in the same location?
If so, how would I prevent that?
Baseplate loading code:
function loadPlayerData(player)
for i, v in ipairs(sessionData[player][Items]) do
local Base = workspace:WaitForChild('Baseplates'):WaitForChild(player.Name)
local Item = game:GetService'ReplicatedStorage':WaitForChild('gameItems'):FindFirstChild(sessionData[player].Items[v.Name]):Clone()
Item.Parent = Base:WaitForChild("itemHolder")
Item.CFrame = CFrame.new(sessionData[player].Items[v.Name].CFrameValues)
end
end
game.Players.PlayerAdded:connect(loadPlayerData)
There might be errors I'm not aware of. I'll fix these errors while someone comes up with an answer.

5 comments
I do not understand your question.
Alright. In a model (which there is FOUR of), there are two items inside. itemHolder, and the actual baseplate. Everytime someone places an object down, nothing happens. Every autosave, the game gets EVERYTHING in the user's baseplate, and saves it. If someone leaves (because if someone leaves, it autosaves also), would it spawn multiple parts in the same area on join?
There would probably not be any diffrences though, the models are the same and they overlap.
Sell crates are taken into consideration, that's the problem. If two sell crates are in one position, then double the money from one sell crate. That would be kind of overpowered in the long run.
Agree. They could get a lot of money by keep quitting and joining the game.