Loading saved ObjectValue in Datastore

I am trying to load a saved ObjectValue with my datastore. I am lost on how I’d get it to load back into the Inventory folder. (Player > Inventory)

This is the data loading here. I don’t know how to add the value to this.

local data
	local success, err = pcall(function()
		
		data = dataStore:GetAsync(player.UserId)
		print(data)

	end)

	if success and data then
		print(data)
		dropcoins.Value = data[1]
		winsStat.Value = data[2]
		itemStat.Value = data[3]

	else
		print(player.Name.. " has no data! Default values have been assigned.")
	end
end)

I know the value is saved in ‘data’ because it prints the value along with the other saved values.

I just need to know how I can load it. The names of the value will differ user to user because the values are created by the unboxing system I made. So I guess I just need to know how to find the objectValue and parent it to the inventory folder so it will be recognised.

Any questions or if I missed something let me know :slight_smile:

so lost right now

Object variables are not compatible with DataStores.

1 Like

that includes objectValues? and so theres no way at all to save /load them?

Correct.

If you don’t have differencing/unique properties to each player/save, just save the object name instead, then find the object using that name when loading.

If objects are unique to each player/save and you need to save object info, save the necessary properties of the object in a table instead. Any properties in Enum / Vector / UDim / CFrame format will need to be serialized (converted to string/numbers).

1 Like