Attempt to index number with 'Equipped'

  1. What do you want to achieve? Players should be able to purchase these stands without issue instead when the player purchases a skin the purchasable items are u

  2. What is the issue? Include enough details if possible! Players are unable to equip items they have purchased

  3. What solutions have you thought of so far? Currently If I purchase the item next to the default item it is fine but If I don’t it bugs out again

Config

module.Shop = {
	
	[1] = {
		
		StandImageId = 124767020745901, 
		DevId = 0
		
	},
	
	[2] = {
		
		StandImageId = 102978695088438, 
		DevId = 2689792723
		
	},
	
	[3] = {

		StandImageId = 118537225884832, 
		DevId = 2692382331

	},
	
	[4] = {

		StandImageId = 70564023924812, 
		DevId = 2692382096

	},
	
	[5] = {

		StandImageId = 124769272735715, 
		DevId = 2692382513

	}

	
}

module.DefaultStands = {
	
	[1] = {Equipped = true},
	
}

Client

local function loadSkins(data)
		
		
		local data = data or Remotes.Client:InvokeServer("Get Skins")
		warn("DATA", data)
		
		if not data then return end
		for i,v in skinTemplates do
			v:Destroy()
		end
		for i,v in buttonEvents do
			v:Disconnect()
		end
		for id, standData in Config.Shop do
			
			local PlayerOwnItem = data[id] or false
			local productInfo = standData.DevId~=0 and MarketPlaceService:GetProductInfo(standData.DevId, Enum.InfoType.Product) or {PriceInRobux = 0}
			local price = productInfo["PriceInRobux"] or 0

			local c = skinTemplate:Clone()
			c.ImageLabel.Image = "rbxassetid://"..standData.StandImageId
			c.Parent = Skins.Options.Holder
			
			
			if PlayerOwnItem then
				c.Price.Text= PlayerOwnItem.Equipped and "Equipped" or ""
				if PlayerOwnItem.Equipped then
					applySkin(id)
				end
			else
				c.Price.Text ="R$"..price
			end
			c.LayoutOrder = price
			
			table.insert(buttonEvents, c.MouseButton1Click:Connect(function()
				
				if not PlayerOwnItem then
					local success, result = pcall(function()
						if not productInfo then return end
						return MarketPlaceService:PromptProductPurchase(player, standData.DevId)
					end)
				elseif PlayerOwnItem then
					Remotes.Client:InvokeServer("Equip Skin", id)			
				end	
				
			end))
			
			_guifuncs.initialize({ClickBtn= c,hoverSound = false, Speed = .1, Frame = c, hoverScaleX = 1, hoverScaleY = 1, clickScaleX  = 0.95, clickScaleY = 0.9})
			table.insert(skinTemplates,c)
			c.Visible = true
		end
		
	end	
	
	local skinData = Remotes.Client:InvokeServer("Get Skins")
	loadSkins(skinData)

for id, standData in Config.Shop do
-- Adding a print here
print(id, standData)
local PlayerOwnItem = data[id] or false

debug

1 Like