Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Instances + Data Stores?

Im not sure how to save Instances with Data stores, It says on the wiki to create a function to turn it into a table, But how would I do that? I dont use Tables alot, and my game consists of over 50k+ bricks, So saving each brick's property and loading a new instance doesnt seem very efficient.~~~~~~~~~~~~~~~~~


1 answer

✓ Accepted answer

I created a quick module to do something like this, just for experimental purposes. This is how it came out, remember that you will need to modify this script to make it updated for improved usage. (Using JSON, etc.)

local Parts = {}

function Parts:Create(Part)
	self[Part.Name] = {['BrickColor'] = Part.BrickColor, ['Name'] = Part.Name, ['Position'] = Part.Position, ['Anchored'] = Part.Anchored, ['CanCollide'] = Part.CanCollide, ['FormFactor'] = Part.FormFactor, ['Size'] = Part.Size}
	return self
end

return Parts

3 comments

0

Saving 50,000 blocks in tables is not very realistic, you must remember that the DataStore saves tables internally as JSON and have a maximum length of 65536 characters per sync, there are scripts/modules that encode instances into strings, here is an example of one http://www.roblox.com/--item?id=176696010

0

Interesting, hadn't seen that yet. I agree, it's not realistic but saving Instances isn't very good on ROBLOX.

0

Thanks! This helped me alot!

This discussion is preserved as it was. New answers, comments, and votes are closed.