So this is my datastore for my hats, it adds the values into the table but it doesn't add the table to the data store?

Module

function module.savehats(player)
	warn("A[1")
	--if cansavehats == true or alredysavedhats == false then
		warn("B[1")
		
		local HatsTableSave =  {}
		
	for i,v in pairs(player:WaitForChild("Inventory").Hats:GetChildren()) do
		table.insert(HatsTableSave, v.Name)
		table.insert(HatsTableSave, v.Value)
		table.insert(HatsTableSave, v:WaitForChild("ImageID").Value)
		table.insert(HatsTableSave, v:WaitForChild("Rarity").Value)
		warn("X")
		HatsData:SetAsync(player.UserId, HatsTableSave)
		warn("Xm")
	end

		local function checking()
			HatsData:SetAsync(player.UserId, HatsTableSave)
		end

		local sucess, err = pcall(checking)
		
		if sucess then
			warn("Success")		
		else
			print("Error while saving: "..err)
			local plr = player
			module.savehats(plr)
		end
	--end
end

Output

 A[1
 B[1
 X

That's all it outputs? I don't know what I'm doing wrong, any fixes

1 comment

0

help