Table < Number Error

Hello, I am making a sort of Shop system followed from a YT tutorial so I can get an idea on how to do Tables and Data management on future projects.

There is one problem happening though, whenever I test the game, I get an error in the Output and it says the following:

game.ReplicatedStorage.Events.Crafting.SendData.OnClientEvent:Connect(function()
	
	local orderedWeapons = {}
	
	for i,v in pairs(game.ReplicatedStorage.Items:GetChildren()) do
		table.insert(orderedWeapons,v)
	end
	
    table.sort(orderedWeapons, function(a, b) return a:GetAttributes("Price") < b:GetAttribute("Price") end) -- Line of code the output is having trouble with
	
	for i,v in pairs(orderedWeapons) do
		
		local frame = createCraftingFrame(v.Name, v:GetAttribute("Price"), v, crafting.CraftFrame.ScrollingFrame)

I don’t know what to do after a long while of trying to look for posts to resolve this but have gotten different problems from what I’m experiencing.

What do I do about this?

You accidentally did GetAttributes. Change it to GetAttribute.

Instead of using :GetAttributes() use :GetAttribute(attributeName), it will result in a value instead of an array.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.