Saving part position to a build?

So, i have always wondered how coeptus created his house building system. In Bloxburg you can place down an item and the position of that item in the house you are building saves from game to game. But also in bloxburg there are house slots which are different positions of the map. If i were to save the position of an item placed and a player rejoins and finds themself in a different house slot, the saved item position would not be in the house like it was with the previous house slot? It would be in the position of my old house slot. How is this done so each item is saved in the position of the house? (Sorry if this wasnt very clear)

1 Like

Instead of saving the actual position of the part relative to the center point, the part’s position is saved relative to the house.
One approach could be to get the center position of the house and then add or subtract to/from that position vector to decide where a part will go.
If you are using a snap/grid system, you could also just give particular grids certain values to more easily decide where a part is to be placed.

1 Like

This answers my question. Thanks so much!

1 Like

To get a part’s local cframe for saving or transporting:

function GetLocalCF(CenterPart, Part)
  return CenterPart.CFrame:ToObjectSpace(Part.CFrame)
end

To get the part’s new cframe from the saved cframe:

function GetWorldCF(CenterPart, SavedCF)
  return CenterPart.CFrame:ToWorldSpace(SavedCF)
end
1 Like

Wow thankyou! I didnt know this until now!