Heres the end of my script, the beginning works good and I go have a pcall in the beginning,

		local ownedCarts = {}
		local getCartData = CartData:GetAsync(player.userId)
		local getCartUpgrade = CartUpgrade:GetAsync(player.userId)
		local folder = Instance.new("Folder",player)
		folder.Name = "CartInfo"
		if getCartData then
			for i,v in pairs(getCartData) do
				table.insert(ownedCarts,v)
				for i = 1,#ownedCarts do
					local newInt = Instance.new("IntValue",folder)
					newInt.Name = ownedCarts[i]
					newInt.Value = 
				end
				
			end
		else
			
		end
	
		while wait(60) do
			StatData:SetAsync(player.userId, {level.Value,coins.Value})
			for i,v in pairs(player.CartInfo:GetChildren()) do
				if v then
					CartData:SetAsync(player.userId,v)
				else
					print("Nope")
				end
			end
		end
	end)
end)

So basically what I did is when a player joins it creates IntValues of the Cart Names that they have purchased. I want to keep track of an upgrade that they purchased that goes from 0-5

I have 2 questions,

How do I add a name of the cart to the list of carts that they already purchased in the DataStore

How do I save and connect the upgrades that they purchased to that vehicle?

1 comment

0

Why there's a NewInt.Value = ?