Is it possible to save parts with datastores? if so how, I've been looking high and low and I haven't been able to find anything. Could someone help me out please, Thanks in advance :)
Hey there derfvb123,
No. You cannot save instances in DataStore. The DataStore manual explicitly states that you cannot do so. You can, however, save data about the parts that you want to save. Like so:
local Part = path.To.Part local DataStore = game:GetService("DataStoreService"):GetDataStore("PartData") local PartData = { Position = { Part.CFrame:components() }; Color = Part.BrickColor.Name; -- ... other properties... } DataStore:SetAsync("PartOne", PartData)
To render the part again, you would do the following:
local function RenderPart(partData) local part = Instance.new("Part", game.Workspace) part.CFrame = CFrame.new(unpack(partData.Position)) part.BrickColor = BrickColor.new(partData.Color) -- Other setup... end local partData = DataStore:GetAsync("PartOne") RenderPart(partData)
I'll leave the rest to your imagination (and ingenuity.) Have a nice day derfvb123, and best of luck with your project!
Warm regards,
tkcmdr
Sources: