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

Save location of a model to a datastore?

Hi, I'm just wondering. I've got a game that saves a players base to an instance at the moment. I'd rather move to datastores for this as I have done with the rest of the player data. It's a bit long winded due to datastores not saving instances.

I thought maybe I could save each models location in the players base to a datastore and load that up each time they join so all of the models would be in the exact location they left it. I can easily sort out Primary parts and such for moving the whole lot after it's spawned in, if the player is in another location. But for now what would be the easiest way to grab all of the models in the base, get their XYZ and save it to a datastore?

I thinking maybe something along the lines of this, possibly storing the values into a table and somehow retrieving that and splitting it up?

objects = {"Basic Conveyor","-62.5, -0.5, 99","Advanced Conveyor","-62.5, -0.5, 84"}

Thanks in advance.

1 answer

✓ Accepted answer

Try saving it in a multi-dimentional table/array. I've done that in the past and it works fine.

Objects = {}

for _,Model in pairs(Base:GetChildren()) do

table.insert(Objects,Model.Name)

table.insert(Objects,{
	Model.PrimaryPart.X,
	Model.PrimaryPart.Y,
	Model.PrimaryPart.Z
})

end

This way you can easily load it out as well.

If you need more info feel free to leave a coment.

1 comment

0

pretty good

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