"Attempt to call a instance Value" Error

So im not sure why this is happening

game.ReplicatedStorage.Events.DataUpdater.OnServerEvent:Connect(function(player)
	local InventoryStore = datastore2("Inventory", player)
	UpdateInventory()
	InventoryStore:Update(Armor) 
	
end)

If you are trying to save an instance, you cannot save instances in datastores.

1 Like

no, im trying to save armor gui When the armor is in the players inventory gui

Guis are classified as instances.

Does the armor is a instance value ? If yes, you need to do Armor.Value

oh i had no idea, then i guess yes

the armor has an instance value but isn’t

Just like :UpdateAsync on regular global data stores, it takes a function, and the DataStore2 wrapper has the same functionality.

- InventoryStore:Update(Armor) 
+ InventoryStore:Update(function()
+ 	return Armor
+ end)

But like mentioned you still can’t save Instances, you’ll need to serialize that somehow.

Now this error shows up

	inventoryString.Value = decodedData

What does this mean?

This means inventoryString is a StringValue, and you’re trying to set its Value property to decodedData, which looks to be an Instance, so you’ll have to use its Name or serialize it or something

InventoryString.Name?
DecodedData is this

InventoryStore:OnUpdate(function(decodedData, player)