I have created a placement system and this worked without any problems, however, I tried when loading the Playerbase to add a standard rotatio which makes it possible to change the orientation of all the objects of a player base at once. However, I came across a problem here. When loading the rotated player base sometimes all the objects move by 0.5
.
This is my loading function:
function loadPlayerData(player, dataTable, Base) if dataTable ~= nil then for _, object in pairs(dataTable["PlacedObjects"]) do if object["Name"] ~= "Anchor" then local Model = game.ReplicatedStorage.PlaceableObjects:FindFirstChild(object["Name"]):WaitForChild("PlacedModel"):Clone() Model.Name = object["Name"] Model.Parent = Base.PlacedObjects Model:SetPrimaryPartCFrame(Base.Grid.CFrame + Vector3.new(object["XPos"], object["YPos"], object["ZPos"])) Model.Rotation.Value = object["Rotation"] + game.Workspace:WaitForChild(player:WaitForChild("PlayerSystem"):WaitForChild("Values").PlayerBase.Value).Settings.BaseRotation.Value Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(object["Rotation"]),0)) end end local PlacedObjectsModel = game.Workspace:WaitForChild(player.PlayerSystem.Values.PlayerBase.Value).PlacedObjects PlacedObjectsModel:SetPrimaryPartCFrame(PlacedObjectsModel:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(Base.Settings.BaseRotation.Value) ,0)) end end
And this is my save function:
function generateDataTable(player, Base) local PlacedObjects = {} local TempObject = Base.PlacedObjects:Clone() local cframe = TempObject.PrimaryPart.CFrame TempObject:SetPrimaryPartCFrame(cframe * CFrame.Angles(0, math.rad( - Base.Settings.BaseRotation.Value), 0)) for _, object in pairs (TempObject:GetChildren()) do if object.Name ~= "Anchor" then local vector,axis = object:GetPrimaryPartCFrame():toAxisAngle() local pos = object.PrimaryPart.Position - Base.Grid.Position table.insert(PlacedObjects, { ["Name"] = object.Name, ["XPos"] = pos.X, ["YPos"] = pos.y, ["ZPos"] = pos.z, ["Rotation"] = object.Rotation.Value - Base.Settings.BaseRotation.Value}) end end local dataTable = { ["PlacedObjects"] = PlacedObjects } TempObject:Destroy() return dataTable end