I've been trying to save the list of owned cars that a player has into a datastore. Here's a screeenshot of the way the ownedCars folder looks: https://i.gyazo.com/b51086371276c61e3d8a6ceac505a1e9.png I've never used a table other than just a regular array but I'm needing this one to save the car name and then information linked to each car like color and registration number.

I've not been getting any errors in the datastore script but it's not saving the information. The datastore itself is fine as there is other values stored in it that save fine.

local ownedCarsTable = {}
local ownedCars = player.playerStats.ownedCars:GetChildren()
if ownedCars ~= nil then
	for i = 1, #ownedCars do
		ownedCarsTable = {
			vehicleName = ownedCars[i].Value,
			vehicleColor = ownedCars[i].CarColor.Value,
		}
	end
	myDataStore:SetAsync(player.UserId.."-ownedCars",ownedCarsTable)
end

2 comments

0

Have you used myDataStore:GetAsync()?

0

Yes I just didn't want to give the entire datastore script with all it's values out. I used this to try retreieve the data from the datastore ````ownedCarsTable = myDataStore:GetAsync(player.UserId.."-ownedCars")```