Problem

Players.BubbasaurusNotBubble.PlayerGui.ScreenGui.ShopFrame.LocalScript:42: attempt to index nil with 'Name'

script:

player = game.Players.LocalPlayer GearInventory = player.GearInventory GearShop = game.ReplicatedStorage.GearShop selected = nil

function LoadGearShop () for i,currentGear in pairs (GearShop:GetChildren()) do local Button = Instance.new("ImageButton", script.Parent.ScrollingFrame.Items) Button.Image = currentGear.Info.Decal.Texture Button.Name = currentGear.Name Button.BorderSizePixel = 0 Button.BackgroundColor3 = Color3.new(1,1,1)

	Button.MouseButton1Click:connect(function ()
		selected = currentGear
		
		script.Parent.Preview.NameLabel.Text = currentGear.Info.DisplayName.Value
		script.Parent.Preview.PriceLabel.Text = currentGear.Info.Price.Value .. " P"
		script.Parent.Preview.ImageLabel.Image = currentGear.Info.Decal.Texture
		
		if GearInventory:FindFirstChild(currentGear.Name) then
			if GearInventory:FindFirstChild(currentGear.Name).Value then
				script.Parent.Preview.BuyButton.Text = "Unequip"
			else
				script.Parent.Preview.BuyButton.Text = "Equip"
			end
		else
			script.Parent.Preview.BuyButton.Text = "Buy"
		end
	end)
end

end

LoadGearShop()

script.Parent.Preview.BuyButton.MouseButton1Click:connect(function () if script.Parent.Preview.BuyButton.Text == "Equip" then game.ReplicatedStorage.Shop:InvokeServer("Equip Gear", selected.Name) elseif script.Parent.Preview.BuyButton.Text == "Unequip" then game.ReplicatedStorage.Shop:InvokeServer("Unequip Gear", selected.Name) elseif script.Parent.Preview.BuyButton.Text == "Buy" then game.ReplicatedStorage.Shop:InvokeServer("Buy Gear", selected.Name) end end)