I was reading on the Roblox Wiki about the new multi place games... And I was wondering if its possible to save objects that players built in one place and spawn it in another place.
I haven't tried coding anything so far... My video card went up in my gaming pc so I'm currently awaiting the delivery of another one. However I did read in the Wiki and there's some part about not being able to store instances but creating a function that adds them to a table.
So my question is... Is it possible to transport player built models from one place to another using Data Stores?
Yes it is very possible. The best way to accomplish this is to create a table of properties to save. Remember that you cannot save any type of userdata either, so properties like CFrame
and BrickColor
will have to be saved a different way.
Here is some example code
local function PartToTable(Part) local Table = {} -- table that will hold all the properties local NormalProperties = {"Transparency", "CanCollide"} -- Non userdata properties of a part. I just added a couple for i,v in pairs(NormalProperties) -- loop through the basic properties Table[v] = Part[v] -- Add to table end -- Custom properties Table["CFrame"] = {Part.CFrame:components()} Table["BrickColor"] = Part.BrickColor.Name return Table end local function TableToPart(Table) local Part = Instance.new("Part") for i,v in pairs(Table) do Part[i] = v -- set the basic properties end Part.CFrame = unpack(Table["CFrame"]) -- set the userdata properties Part.BrickColor = BrickColor.new(Table["BrickColor"])' return Part end
Let me know if you have any questions about the example code I provided.
Try to get this sample
http://www.roblox.com/Create-Place-Lobby-place?id=146051778 http://www.roblox.com/Create-Place-Zone-place?id=146059799
And edit it..... i tried it then it works......
finished product: http://www.roblox.com/Build-your-own-Universe-Finished-Game-place?id=154470806