If you have a primary part for all placeables, you can get those placeables’ primary part position by a basic CFrame formula. If I remember it right, it should be Plot.CFrame:inverse() * Object.PrimaryPart.CFrame
and it basically subtracts plot CFrame from object PP CFrame. You also can use xuefei’s suggested methods.
Saving every placeable to a folder will give you chance to form a table easily. Like…
local SavingTable = {}
for i,v in pairs(Placed:GetChildren()) do
local SavingCF = Plot.CFrame:inverse() * v.PrimaryPart.CFrame
table.insert(SavingTable, {SavingCF, ItemID, ...})
end
Finally, use JsonEncode to turn SavingTable into a string as iRexBot suggested because you can’t save MetaTables(Tables inside tables).
The console outputs that. The top string of numbers is the “SavingCF”
for i,v in pairs(TycoonValue.Value.Bin:GetChildren()) do
local SavingCF = TycoonValue.Value.TycoonBaseplate.CFrame:inverse() * v.PrimaryPart.CFrame
print(SavingCF)
table.insert(ServerData[plr].TycoonPlacements, {SavingCF, ItemData.Objects[v.Name][7]})
end
local EncodedData = HttpService:JSONEncode(ServerData[plr])
print(EncodedData)
Oh that’s a bit confusing
To be honest I never used this method. Maybe it is not possible to encode CFrame? In this case, you could save position and rotation instead of CFrame itself. Also feel free to use grilme’s method too, if it would be easier for you
The second baseplate is where I orginally placed the chairs, then I got the one closer to the camera and the chairs went wild, not even on a baseplate.
for i,v in pairs(ServerData[plr].TycoonPlacements) do
local CFramePosition = CFrame.new(unpack(v.Position))* CFrame.new(TycoonValue.Value.TycoonBaseplate.CFrame:components())
local GenerateObject = Items:FindFirstChild(v.ObjName):Clone()
GenerateObject.Parent = TycoonValue.Value.Bin
GenerateObject:SetPrimaryPartCFrame(CFramePosition)
end
for i,v in pairs(ServerData[plr].TycoonPlacements) do
local CFramePosition = CFrame.new(unpack(v.Position))* CFrame.new(TycoonValue.Value.TycoonBaseplate.CFrame:components())
local GenerateObject = Items:FindFirstChild(v.ObjName):Clone()
GenerateObject.Parent = TycoonValue.Value.Bin
GenerateObject:SetPrimaryPartCFrame(CFramePosition)
end
And saving
for i,v in pairs(TycoonValue.Value.Bin:GetChildren()) do
local SavingCF = {(v.PrimaryPart.CFrame * TycoonValue.Value.TycoonBaseplate.CFrame:Inverse()):components()}
--print(SavingCF)
table.insert(ServerData[plr].TycoonPlacements, {Position = SavingCF, ObjName = ItemData.Objects[v.Name][1]})
end
It spreads them out a ton, some not even near the baseplates.
No I implemented the method the Tiffblocks said in the post I sent, I can’t see anything wrong with it, wait for Tiff to reply because she will probably know.
I built a game in 2015 that allowed users to build on a plot, which they could save. I don’t think the saving itself works anymore, as I’m sure it used the old data persistence methods (e.g. Player:SaveString(), Player:LoadString()), but the actual packaging of plot data should still work.
I’ve just taken a look back at the code, and I’m pretty sure I could do much better now, but nevertheless, it may be of some help. See the attached place file.